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
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index fe998ee..34b23f1 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -328,6 +328,7 @@
     bool zoomIn();
     bool zoomOut();
     void updatePointer(int x, int y);
+    void showZoomer(SkCanvas* canvas);
 
     void postAnimatingEvent() {
         if (fAnimating) {
@@ -616,7 +617,17 @@
     } 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 @@
         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 @@
             break;
 #ifdef SK_SUPPORT_GL
         case kGPU_CanvasType:
+            if (fShowZoomer) {
+                this->showZoomer(fGpuCanvas);
+            }
             delete fGpuCanvas;
             fGpuCanvas = NULL;
             presentGL();