| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 | 9 |
| 10 namespace skiagm { | 10 namespace skiagm { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Figure out the (x,y) to draw this copy at | 122 // Figure out the (x,y) to draw this copy at |
| 123 SkScalar bitmapX = SkIntToScalar( | 123 SkScalar bitmapX = SkIntToScalar( |
| 124 x + quarterWidth * 5 * (xMult+1)); | 124 x + quarterWidth * 5 * (xMult+1)); |
| 125 SkScalar bitmapY = SkIntToScalar( | 125 SkScalar bitmapY = SkIntToScalar( |
| 126 y + quarterHeight * 5 * (yMult+1)); | 126 y + quarterHeight * 5 * (yMult+1)); |
| 127 | 127 |
| 128 // Scroll a new copy of the bitmap, and then draw it. | 128 // Scroll a new copy of the bitmap, and then draw it. |
| 129 // scrollRect() should always return true, even if it's a no-op | 129 // scrollRect() should always return true, even if it's a no-op |
| 130 SkBitmap scrolledBitmap; | 130 SkBitmap scrolledBitmap; |
| 131 SkDEBUGCODE(bool copyToReturnValue = )origBitmap.copyTo( | 131 SkDEBUGCODE(bool copyToReturnValue = )origBitmap.copyTo( |
| 132 &scrolledBitmap, origBitmap.config()); | 132 &scrolledBitmap, origBitmap.colorType()); |
| 133 SkASSERT(copyToReturnValue); | 133 SkASSERT(copyToReturnValue); |
| 134 SkDEBUGCODE(bool scrollRectReturnValue = )scrolledBitmap.scrollR
ect( | 134 SkDEBUGCODE(bool scrollRectReturnValue = )scrolledBitmap.scrollR
ect( |
| 135 subset, scrollX * xMult, scrollY * yMult); | 135 subset, scrollX * xMult, scrollY * yMult); |
| 136 SkASSERT(scrollRectReturnValue); | 136 SkASSERT(scrollRectReturnValue); |
| 137 canvas->drawBitmap(scrolledBitmap, bitmapX, bitmapY); | 137 canvas->drawBitmap(scrolledBitmap, bitmapX, bitmapY); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 typedef GM INHERITED; | 143 typedef GM INHERITED; |
| 144 static const int quarterWidth = 10; | 144 static const int quarterWidth = 10; |
| 145 static const int quarterHeight = 14; | 145 static const int quarterHeight = 14; |
| 146 SkBitmap origBitmap; | 146 SkBitmap origBitmap; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 ////////////////////////////////////////////////////////////////////////////// | 149 ////////////////////////////////////////////////////////////////////////////// |
| 150 | 150 |
| 151 static GM* MyFactory(void*) { return new BitmapScrollGM; } | 151 static GM* MyFactory(void*) { return new BitmapScrollGM; } |
| 152 static GMRegistry reg(MyFactory); | 152 static GMRegistry reg(MyFactory); |
| 153 | 153 |
| 154 } | 154 } |
| OLD | NEW |