add private flag for sprite-as-bitmap
BUG=skia:3272 Review URL: https://codereview.chromium.org/806853005
This commit is contained in:
parent
8fc6c2d82c
commit
0acf1b4b36
@ -1145,6 +1145,8 @@ public:
|
||||
// don't call
|
||||
static void Internal_Private_SetIgnoreSaveLayerBounds(bool);
|
||||
static bool Internal_Private_GetIgnoreSaveLayerBounds();
|
||||
static void Internal_Private_SetTreatSpriteAsBitmap(bool);
|
||||
static bool Internal_Private_GetTreatSpriteAsBitmap();
|
||||
|
||||
protected:
|
||||
// default impl defers to getDevice()->newSurface(info)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user