aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-06-10 02:12:47 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-06-10 02:12:47 +0000
commit199f108f14a5f60a9c2205ffa79b26102a206ad0 (patch)
tree9486ea6b42c81f5fece079339ae48869755b26f4 /src/core
parent829c83c7c9a997993207b68f6fcaf7a5bbcd10b2 (diff)
only call SkDevice::gainFocus() if we're actually drawing to a different device.
Saves overhead when using GL. git-svn-id: http://skia.googlecode.com/svn/trunk@207 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCanvas.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 38135c6993..852b25e992 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -248,7 +248,7 @@ public:
}
// fCurrLayer may be NULL now
-
+
fCanvas->prepareForDeviceDraw(fDevice);
return true;
}
@@ -390,6 +390,7 @@ private:
SkDevice* SkCanvas::init(SkDevice* device) {
fBounder = NULL;
fLocalBoundsCompareTypeDirty = true;
+ fLastDeviceToGainFocus = NULL;
fMCRec = (MCRec*)fMCStack.push_back();
new (fMCRec) MCRec(NULL, 0);
@@ -546,7 +547,10 @@ void SkCanvas::updateDeviceCMCache() {
void SkCanvas::prepareForDeviceDraw(SkDevice* device) {
SkASSERT(device);
- device->gainFocus(this);
+ if (fLastDeviceToGainFocus != device) {
+ device->gainFocus(this);
+ fLastDeviceToGainFocus = device;
+ }
}
///////////////////////////////////////////////////////////////////////////////