Reason for revert:
SK_ATTR_DEPRECATED is meaningful to Android. Don't use it.
Original issue's description:
> 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
TBR=reed@google.com,scroggo@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4259
Review URL: https://codereview.chromium.org/
1314483006
w.show();
int result = a.exec();
+ SkGraphics::Term();
return result;
}
void application_term() {
SkEvent::Term();
+ SkGraphics::Term();
}
HelloWorldWindow::HelloWorldWindow(void* hwnd)
// SkRect r = {50, 50, 80, 80};
p.setColor(0xAA11EEAA);
// canvas->drawRect(r, p);
-
+
SkRect result;
SkPath path;
path.moveTo(0, 0);
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);
}
private:
- typedef SkView INHERITED;
+ typedef SkView INHERITED;
};
void application_init();
path.hasRectangularInterior(©);
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;
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;
}
void application_term() {
+ SkGraphics::Term();
SkEvent::Term();
}
-/*
- * 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"
canvas->drawRect(r, p);
}
private:
- typedef SkView INHERITED;
+ typedef SkView INHERITED;
};
void application_init() {
}
void application_term() {
+ SkGraphics::Term();
SkEvent::Term();
}
void application_term() {
SkEvent::Term();
+ SkGraphics::Term();
}
SkV8ExampleWindow::SkV8ExampleWindow(void* hwnd, JsContext* context)
*/
static void Init();
- SK_ATTR_DEPRECATED("SkGraphics::Term() is a no-op. We're in the middle of cleaning it up.")
- static void Term() {}
+ /**
+ * Call this to release any memory held privately, such as the font cache.
+ */
+ static void Term();
/**
* Return the version numbers for the library. If the parameter is not
SkAutoGraphics() {
SkGraphics::Init();
}
+ ~SkAutoGraphics() {
+ SkGraphics::Term();
+ }
};
#endif
SkFilterQuality getFilterQuality() const {
return (SkFilterQuality)fBitfields.fFilterQuality;
}
-
+
/**
* Set the filter quality. This affects the quality (and performance) of
* drawing scaled images.
*/
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.
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;
*/
static void Init();
/** Global cleanup function for the SkEvent system. Should be called exactly once after
- all event methods have been called.
+ all event methods have been called, and should be called before calling SkGraphics::Term().
*/
static void Term();
void application_term() {
SkEvent::Term();
+ SkGraphics::Term();
}
#endif
}
+void SkGraphics::Term() {
+ PurgeFontCache();
+ PurgeResourceCache();
+ SkPaint::Term();
+}
+
///////////////////////////////////////////////////////////////////////////////
void SkGraphics::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
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)
*/
test->run();
}
}
+ SkGraphics::Term();
return 0;
}
void application_term() {
SkEvent::Term();
+ SkGraphics::Term();
}
SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
SkDebugf("opt %d: %d\n", opt, gOptTable[opt].fNumTimesApplied);
}
+ SkGraphics::Term();
return 0;
}
void application_term();
void application_term() {
SkEvent::Term();
+ SkGraphics::Term();
}