| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 8 |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 SkAutoUnref aur(device); | 132 SkAutoUnref aur(device); |
| 133 src = device->accessBitmap(false); | 133 src = device->accessBitmap(false); |
| 134 device->clear(SK_ColorWHITE); | 134 device->clear(SK_ColorWHITE); |
| 135 | 135 |
| 136 // Draw something different to the same portion of the bitmap that w
e will extract as a | 136 // Draw something different to the same portion of the bitmap that w
e will extract as a |
| 137 // subset, so that comparing the pixels of the subset will be meanin
gful. | 137 // subset, so that comparing the pixels of the subset will be meanin
gful. |
| 138 SkIRect subsetRect = SkIRect::MakeLTRB(W/2, H/2, W, H); | 138 SkIRect subsetRect = SkIRect::MakeLTRB(W/2, H/2, W, H); |
| 139 SkCanvas drawingCanvas(device); | 139 SkCanvas drawingCanvas(device); |
| 140 SkPaint paint; | 140 SkPaint paint; |
| 141 paint.setColor(SK_ColorRED); | 141 paint.setColor(SK_ColorRED); |
| 142 drawingCanvas.drawRect(SkRect::MakeFromIRect(subsetRect), paint); | 142 drawingCanvas.drawRect(SkRect::Make(subsetRect), paint); |
| 143 | 143 |
| 144 // Extract a subset. If this succeeds we will test copying the subse
t. | 144 // Extract a subset. If this succeeds we will test copying the subse
t. |
| 145 SkBitmap subset; | 145 SkBitmap subset; |
| 146 const bool extracted = src.extractSubset(&subset, subsetRect); | 146 const bool extracted = src.extractSubset(&subset, subsetRect); |
| 147 | 147 |
| 148 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) { | 148 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) { |
| 149 dst.reset(); | 149 dst.reset(); |
| 150 bool success = src.deepCopyTo(&dst, gPairs[j].fConfig); | 150 bool success = src.deepCopyTo(&dst, gPairs[j].fConfig); |
| 151 bool expected = gPairs[i].fValid[j] != '0'; | 151 bool expected = gPairs[i].fValid[j] != '0'; |
| 152 if (success != expected) { | 152 if (success != expected) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 } // for (size_t j = ... | 189 } // for (size_t j = ... |
| 190 } // for (size_t i = ... | 190 } // for (size_t i = ... |
| 191 } // GrContextFactory::GLContextType | 191 } // GrContextFactory::GLContextType |
| 192 } | 192 } |
| 193 | 193 |
| 194 #include "TestClassDef.h" | 194 #include "TestClassDef.h" |
| 195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) | 195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) |
| 196 | 196 |
| 197 #endif | 197 #endif |
| OLD | NEW |