Skip to content

Commit

Permalink
Make SkGraphics::Term a no-op, stop calling it.
Browse files Browse the repository at this point in the history
I'd remove it entirely but Android is calling it explicitly.

BUG=skia:4259

Review URL: https://codereview.chromium.org/1329853005
  • Loading branch information
mtklein authored and Commit bot committed Sep 8, 2015
1 parent 87a5c9f commit 925979f
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 48 deletions.
1 change: 0 additions & 1 deletion debugger/debuggermain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ int main(int argc, char *argv[]) {

w.show();
int result = a.exec();
SkGraphics::Term();
return result;
}
1 change: 0 additions & 1 deletion example/HelloWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void application_init() {

void application_term() {
SkEvent::Term();
SkGraphics::Term();
}

HelloWorldWindow::HelloWorldWindow(void* hwnd)
Expand Down
15 changes: 7 additions & 8 deletions experimental/SimpleCocoaApp/SimpleApp.mm
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ virtual void onDraw(SkCanvas* canvas) {
// SkRect r = {50, 50, 80, 80};
p.setColor(0xAA11EEAA);
// canvas->drawRect(r, p);

SkRect result;
SkPath path;
path.moveTo(0, 0);
path.lineTo(1, 1);
path.lineTo(1, 8);
path.lineTo(0, 9);
SkASSERT(path.hasRectangularInterior(&result));

path.reset();
path.addRect(10, 10, 100, 100, SkPath::kCW_Direction);
path.addRect(20, 20, 50, 50, SkPath::kCW_Direction);
Expand All @@ -94,7 +94,7 @@ virtual void onDraw(SkCanvas* canvas) {

}
private:
typedef SkView INHERITED;
typedef SkView INHERITED;
};

void application_init();
Expand Down Expand Up @@ -194,12 +194,12 @@ virtual void drawPath(const SkPath& path, const SkPaint& paint) {
path.hasRectangularInterior(&copy);
SkDebugf("</div>\n\n");
}

virtual void drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
}

public:
void divName(const SkString& str, bool only) {
filename = str;
Expand All @@ -211,14 +211,14 @@ void divName(const SkString& str, bool only) {
count = 0;
nameonly = only;
}

void init() {
pointsMin = verbsMin = SK_MaxS32;
pointsMax = verbsMax = SK_MinS32;
rectPointsMin = rectVerbsMin = SK_MaxS32;
rectPointsMax = rectVerbsMax = SK_MinS32;
}

SkString filename;
int count;
bool nameonly;
Expand Down Expand Up @@ -279,7 +279,6 @@ void application_init() {
}

void application_term() {
SkGraphics::Term();
SkEvent::Term();
}

Expand Down
10 changes: 8 additions & 2 deletions experimental/SimpleiOSApp/SimpleApp.mm
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#include "SkApplication.h"
#import "SkCanvas.h"
#import "SkPaint.h"
Expand Down Expand Up @@ -26,7 +33,7 @@ virtual void onDraw(SkCanvas* canvas) {
canvas->drawRect(r, p);
}
private:
typedef SkView INHERITED;
typedef SkView INHERITED;
};

void application_init() {
Expand All @@ -35,7 +42,6 @@ void application_init() {
}

void application_term() {
SkGraphics::Term();
SkEvent::Term();
}

Expand Down
1 change: 0 additions & 1 deletion experimental/SkV8Example/SkV8Example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void application_init() {

void application_term() {
SkEvent::Term();
SkGraphics::Term();
}

SkV8ExampleWindow::SkV8ExampleWindow(void* hwnd, JsContext* context)
Expand Down
9 changes: 2 additions & 7 deletions include/core/SkGraphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ class SK_API SkGraphics {
*/
static void Init();

/**
* Call this to release any memory held privately, such as the font cache.
*/
static void Term();
SK_ATTR_DEPRECATED("SkGraphics::Term() is a no-op. We're in the middle of cleaning it up.")
static void Term() {}

/**
* Return the version numbers for the library. If the parameter is not
Expand Down Expand Up @@ -169,9 +167,6 @@ class SkAutoGraphics {
SkAutoGraphics() {
SkGraphics::Init();
}
~SkAutoGraphics() {
SkGraphics::Term();
}
};

#endif
5 changes: 1 addition & 4 deletions include/core/SkPaint.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class SK_API SkPaint {
SkFilterQuality getFilterQuality() const {
return (SkFilterQuality)fBitfields.fFilterQuality;
}

/**
* Set the filter quality. This affects the quality (and performance) of
* drawing scaled images.
Expand Down Expand Up @@ -1046,8 +1046,6 @@ class SK_API SkPaint {
*/
SkColor computeLuminanceColor() const;

static void Term();

enum {
/* This is the size we use when we ask for a glyph's path. We then
* post-transform it as we draw to match the request.
Expand Down Expand Up @@ -1090,7 +1088,6 @@ class SK_API SkPaint {
friend class SkAutoGlyphCacheNoGamma;
friend class SkCanvas;
friend class SkDraw;
friend class SkGraphics; // So Term() can be called.
friend class SkPDFDevice;
friend class GrBitmapTextContext;
friend class GrAtlasTextContext;
Expand Down
2 changes: 1 addition & 1 deletion include/views/SkEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class SkEvent {
*/
static void Init();
/** Global cleanup function for the SkEvent system. Should be called exactly once after
all event methods have been called, and should be called before calling SkGraphics::Term().
all event methods have been called.
*/
static void Term();

Expand Down
1 change: 0 additions & 1 deletion samplecode/SampleApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2397,5 +2397,4 @@ void application_init() {

void application_term() {
SkEvent::Term();
SkGraphics::Term();
}
6 changes: 0 additions & 6 deletions src/core/SkGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ void SkGraphics::Init() {
#endif
}

void SkGraphics::Term() {
PurgeFontCache();
PurgeResourceCache();
SkPaint::Term();
}

///////////////////////////////////////////////////////////////////////////////

void SkGraphics::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
Expand Down
12 changes: 0 additions & 12 deletions src/core/SkPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,18 +1525,6 @@ static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
return *gMaskGamma;
}

/*static*/ void SkPaint::Term() {
SkAutoMutexAcquire ama(gMaskGammaCacheMutex);

SkSafeUnref(gLinearMaskGamma);
gLinearMaskGamma = nullptr;
SkSafeUnref(gMaskGamma);
gMaskGamma = nullptr;
SkDEBUGCODE(gContrast = SK_ScalarMin;)
SkDEBUGCODE(gPaintGamma = SK_ScalarMin;)
SkDEBUGCODE(gDeviceGamma = SK_ScalarMin;)
}

/**
* We ensure that the rec is self-consistent and efficient (where possible)
*/
Expand Down
1 change: 0 additions & 1 deletion tests/PathOpsSkpClipTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,6 @@ int tool_main(int argc, char** argv) {
test->run();
}
}
SkGraphics::Term();
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion tools/VisualBench/VisualBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ void application_init() {

void application_term() {
SkEvent::Term();
SkGraphics::Term();
}

SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
Expand Down
1 change: 0 additions & 1 deletion tools/filtermain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,6 @@ int tool_main(int argc, char** argv) {
SkDebugf("opt %d: %d\n", opt, gOptTable[opt].fNumTimesApplied);
}

SkGraphics::Term();
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion tools/iOSShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,4 @@ void application_init() {
void application_term();
void application_term() {
SkEvent::Term();
SkGraphics::Term();
}

0 comments on commit 925979f

Please sign in to comment.