aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar Scroggo <Scroggo@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-25 20:50:42 +0000
committerGravatar Scroggo <Scroggo@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-25 20:50:42 +0000
commit3272ba8abcf322f5e9bcf2f7f2dcddaf68550268 (patch)
treeeba6c2115df5b0449ef38c58ff414e014f4b3d9d /samplecode
parent5d6e108624ee27f9cf6b10a77db2046cb29dc6cc (diff)
Show fatbits mode in openGL. http://codereview.appspot.com/4515141/
git-svn-id: http://skia.googlecode.com/svn/trunk@1426 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index fe998ee732..34b23f1476 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -328,6 +328,7 @@ private:
bool zoomIn();
bool zoomOut();
void updatePointer(int x, int y);
+ void showZoomer(SkCanvas* canvas);
void postAnimatingEvent() {
if (fAnimating) {
@@ -616,7 +617,17 @@ void SampleWindow::draw(SkCanvas* canvas) {
} else {
this->INHERITED::draw(canvas);
}
- if (fShowZoomer) {
+ if (fShowZoomer && fCanvasType != kGPU_CanvasType) {
+ // In the GPU case, INHERITED::draw calls beforeChildren, which
+ // creates an SkGpuCanvas. All further draw calls are directed
+ // at that canvas, which is deleted in afterChildren (which is
+ // also called by draw), so we cannot show the zoomer here.
+ // Instead, we call it inside afterChildren.
+ showZoomer(canvas);
+ }
+}
+
+void SampleWindow::showZoomer(SkCanvas* canvas) {
int count = canvas->save();
canvas->resetMatrix();
// Ensure the mouse position is on screen.
@@ -699,7 +710,7 @@ void SampleWindow::draw(SkCanvas* canvas) {
paint.setColor(SK_ColorBLUE);
drawText(canvas, string, left, SkScalarMulAdd(lineHeight, i, dest.fTop), paint);
canvas->restoreToCount(count);
- }
+ bitmap.unlockPixels();
}
void SampleWindow::onDraw(SkCanvas* canvas) {
@@ -825,6 +836,9 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
break;
#ifdef SK_SUPPORT_GL
case kGPU_CanvasType:
+ if (fShowZoomer) {
+ this->showZoomer(fGpuCanvas);
+ }
delete fGpuCanvas;
fGpuCanvas = NULL;
presentGL();