Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: src/core/SkCanvas.cpp

Issue 806853005: add private flag for sprite-as-bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index c7fb2dd47fd0889990e98192c04e06f8b5129b1d..09b9783cb95d1c954cc5f0e6c6042d9c48a6c1d7 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -42,6 +42,14 @@ bool SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds() {
return gIgnoreSaveLayerBounds;
}
+static bool gTreatSpriteAsBitmap;
+void SkCanvas::Internal_Private_SetTreatSpriteAsBitmap(bool spriteAsBitmap) {
+ gTreatSpriteAsBitmap = spriteAsBitmap;
+}
+bool SkCanvas::Internal_Private_GetTreatSpriteAsBitmap() {
+ return gTreatSpriteAsBitmap;
+}
+
// experimental for faster tiled drawing...
//#define SK_ENABLE_CLIP_QUICKREJECT
@@ -1190,6 +1198,14 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
const SkPaint* paint) {
+ if (gTreatSpriteAsBitmap) {
+ this->save();
+ this->resetMatrix();
+ this->drawBitmap(bitmap, SkIntToScalar(x), SkIntToScalar(y), paint);
+ this->restore();
+ return;
+ }
+
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawSprite()");
if (bitmap.drawsNothing()) {
return;
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698