From fe81e2d274a4948491ed6d4bbce1c96ea0c8f9cd Mon Sep 17 00:00:00 2001 From: mtklein Date: Wed, 9 Sep 2015 07:35:42 -0700 Subject: Make SkGraphics::Term a no-op, stop calling it. I'd remove it entirely but Android is calling it explicitly. BUG=skia:4259 Committed: https://skia.googlesource.com/skia/+/925979f733fe8e70d84627147dee04d030423349 Review URL: https://codereview.chromium.org/1329853005 --- debugger/debuggermain.cpp | 1 - example/HelloWorld.cpp | 1 - experimental/SimpleCocoaApp/SimpleApp.mm | 15 +++++++-------- experimental/SimpleiOSApp/SimpleApp.mm | 10 ++++++++-- experimental/SkV8Example/SkV8Example.cpp | 1 - include/core/SkGraphics.h | 9 ++------- include/core/SkPaint.h | 5 +---- include/views/SkEvent.h | 2 +- samplecode/SampleApp.cpp | 1 - src/core/SkGraphics.cpp | 6 ------ src/core/SkPaint.cpp | 12 ------------ tests/PathOpsSkpClipTest.cpp | 1 - tools/VisualBench/VisualBench.cpp | 1 - tools/filtermain.cpp | 1 - tools/iOSShell.cpp | 1 - 15 files changed, 19 insertions(+), 48 deletions(-) diff --git a/debugger/debuggermain.cpp b/debugger/debuggermain.cpp index 0aec02b9b2..eebcd5f3f1 100644 --- a/debugger/debuggermain.cpp +++ b/debugger/debuggermain.cpp @@ -67,6 +67,5 @@ int main(int argc, char *argv[]) { w.show(); int result = a.exec(); - SkGraphics::Term(); return result; } diff --git a/example/HelloWorld.cpp b/example/HelloWorld.cpp index 495d2af598..0d12d0fb04 100644 --- a/example/HelloWorld.cpp +++ b/example/HelloWorld.cpp @@ -23,7 +23,6 @@ void application_init() { void application_term() { SkEvent::Term(); - SkGraphics::Term(); } HelloWorldWindow::HelloWorldWindow(void* hwnd) diff --git a/experimental/SimpleCocoaApp/SimpleApp.mm b/experimental/SimpleCocoaApp/SimpleApp.mm index 6f9958f7fc..95684c1683 100644 --- a/experimental/SimpleCocoaApp/SimpleApp.mm +++ b/experimental/SimpleCocoaApp/SimpleApp.mm @@ -69,7 +69,7 @@ protected: // SkRect r = {50, 50, 80, 80}; p.setColor(0xAA11EEAA); // canvas->drawRect(r, p); - + SkRect result; SkPath path; path.moveTo(0, 0); @@ -77,7 +77,7 @@ protected: 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); @@ -94,7 +94,7 @@ protected: } private: - typedef SkView INHERITED; + typedef SkView INHERITED; }; void application_init(); @@ -194,12 +194,12 @@ class PathCanvas : public SkCanvas { path.hasRectangularInterior(©); SkDebugf("\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; @@ -211,14 +211,14 @@ public: 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; @@ -279,7 +279,6 @@ void application_init() { } void application_term() { - SkGraphics::Term(); SkEvent::Term(); } diff --git a/experimental/SimpleiOSApp/SimpleApp.mm b/experimental/SimpleiOSApp/SimpleApp.mm index 040472cfe3..123449f4e6 100644 --- a/experimental/SimpleiOSApp/SimpleApp.mm +++ b/experimental/SimpleiOSApp/SimpleApp.mm @@ -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" @@ -26,7 +33,7 @@ protected: canvas->drawRect(r, p); } private: - typedef SkView INHERITED; + typedef SkView INHERITED; }; void application_init() { @@ -35,7 +42,6 @@ void application_init() { } void application_term() { - SkGraphics::Term(); SkEvent::Term(); } diff --git a/experimental/SkV8Example/SkV8Example.cpp b/experimental/SkV8Example/SkV8Example.cpp index d537fd4d38..03a8826c88 100644 --- a/experimental/SkV8Example/SkV8Example.cpp +++ b/experimental/SkV8Example/SkV8Example.cpp @@ -40,7 +40,6 @@ void application_init() { void application_term() { SkEvent::Term(); - SkGraphics::Term(); } SkV8ExampleWindow::SkV8ExampleWindow(void* hwnd, JsContext* context) diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h index 8e8bd77ef4..5aecc7acd0 100644 --- a/include/core/SkGraphics.h +++ b/include/core/SkGraphics.h @@ -23,10 +23,8 @@ public: */ static void Init(); - /** - * Call this to release any memory held privately, such as the font cache. - */ - static void Term(); + // We're in the middle of cleaning this up. + static void Term() {} /** * Return the version numbers for the library. If the parameter is not @@ -169,9 +167,6 @@ public: SkAutoGraphics() { SkGraphics::Init(); } - ~SkAutoGraphics() { - SkGraphics::Term(); - } }; #endif diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 0c071ad361..2090ed2337 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -289,7 +289,7 @@ public: SkFilterQuality getFilterQuality() const { return (SkFilterQuality)fBitfields.fFilterQuality; } - + /** * Set the filter quality. This affects the quality (and performance) of * drawing scaled images. @@ -1046,8 +1046,6 @@ private: */ 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. @@ -1090,7 +1088,6 @@ private: 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; diff --git a/include/views/SkEvent.h b/include/views/SkEvent.h index f4df4482bf..0af76fe686 100644 --- a/include/views/SkEvent.h +++ b/include/views/SkEvent.h @@ -223,7 +223,7 @@ public: */ 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(); diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 22e8b8aa1c..02c5e036a1 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -2397,5 +2397,4 @@ void application_init() { void application_term() { SkEvent::Term(); - SkGraphics::Term(); } diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index e9dcadc180..5290ea1d07 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -58,12 +58,6 @@ void SkGraphics::Init() { #endif } -void SkGraphics::Term() { - PurgeFontCache(); - PurgeResourceCache(); - SkPaint::Term(); -} - /////////////////////////////////////////////////////////////////////////////// void SkGraphics::DumpMemoryStatistics(SkTraceMemoryDump* dump) { diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index c1097204c4..e15c1a74db 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -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) */ diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp index edc79d18e6..7b63c1cda7 100644 --- a/tests/PathOpsSkpClipTest.cpp +++ b/tests/PathOpsSkpClipTest.cpp @@ -1102,7 +1102,6 @@ int tool_main(int argc, char** argv) { test->run(); } } - SkGraphics::Term(); return 0; } diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp index 7b90266677..3c4120469b 100644 --- a/tools/VisualBench/VisualBench.cpp +++ b/tools/VisualBench/VisualBench.cpp @@ -114,7 +114,6 @@ void application_init() { void application_term() { SkEvent::Term(); - SkGraphics::Term(); } SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp index 1ed9797396..24f0c78c02 100644 --- a/tools/filtermain.cpp +++ b/tools/filtermain.cpp @@ -794,7 +794,6 @@ int tool_main(int argc, char** argv) { SkDebugf("opt %d: %d\n", opt, gOptTable[opt].fNumTimesApplied); } - SkGraphics::Term(); return 0; } diff --git a/tools/iOSShell.cpp b/tools/iOSShell.cpp index 1f5f2da229..02884c8e11 100644 --- a/tools/iOSShell.cpp +++ b/tools/iOSShell.cpp @@ -96,5 +96,4 @@ void application_init() { void application_term(); void application_term() { SkEvent::Term(); - SkGraphics::Term(); } -- cgit v1.2.3