OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDecodingImageGenerator.h" | 10 #include "SkDecodingImageGenerator.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType sur
faceType, | 225 static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType sur
faceType, |
226 GrContext* context) { | 226 GrContext* context) { |
227 // Verify that the right canvas commands trigger a copy on write | 227 // Verify that the right canvas commands trigger a copy on write |
228 SkSurface* surface = createSurface(surfaceType, context); | 228 SkSurface* surface = createSurface(surfaceType, context); |
229 SkAutoTUnref<SkSurface> aur_surface(surface); | 229 SkAutoTUnref<SkSurface> aur_surface(surface); |
230 SkCanvas* canvas = surface->getCanvas(); | 230 SkCanvas* canvas = surface->getCanvas(); |
231 | 231 |
232 const SkRect testRect = | 232 const SkRect testRect = |
233 SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0), | 233 SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0), |
234 SkIntToScalar(4), SkIntToScalar(5)); | 234 SkIntToScalar(4), SkIntToScalar(5)); |
235 SkMatrix testMatrix; | |
236 testMatrix.reset(); | |
237 testMatrix.setScale(SkIntToScalar(2), SkIntToScalar(3)); | |
238 | |
239 SkPath testPath; | 235 SkPath testPath; |
240 testPath.addRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0), | 236 testPath.addRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0), |
241 SkIntToScalar(2), SkIntToScalar(1))); | 237 SkIntToScalar(2), SkIntToScalar(1))); |
242 | 238 |
243 const SkIRect testIRect = SkIRect::MakeXYWH(0, 0, 2, 1); | 239 const SkIRect testIRect = SkIRect::MakeXYWH(0, 0, 2, 1); |
244 | 240 |
245 SkRegion testRegion; | 241 SkRegion testRegion; |
246 testRegion.setRect(testIRect); | 242 testRegion.setRect(testIRect); |
247 | 243 |
248 | 244 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 EXPECT_COPY_ON_WRITE(clear(testColor)) | 286 EXPECT_COPY_ON_WRITE(clear(testColor)) |
291 EXPECT_COPY_ON_WRITE(drawPaint(testPaint)) | 287 EXPECT_COPY_ON_WRITE(drawPaint(testPaint)) |
292 EXPECT_COPY_ON_WRITE(drawPoints(SkCanvas::kPoints_PointMode, testPointCount,
testPoints, \ | 288 EXPECT_COPY_ON_WRITE(drawPoints(SkCanvas::kPoints_PointMode, testPointCount,
testPoints, \ |
293 testPaint)) | 289 testPaint)) |
294 EXPECT_COPY_ON_WRITE(drawOval(testRect, testPaint)) | 290 EXPECT_COPY_ON_WRITE(drawOval(testRect, testPaint)) |
295 EXPECT_COPY_ON_WRITE(drawRect(testRect, testPaint)) | 291 EXPECT_COPY_ON_WRITE(drawRect(testRect, testPaint)) |
296 EXPECT_COPY_ON_WRITE(drawRRect(testRRect, testPaint)) | 292 EXPECT_COPY_ON_WRITE(drawRRect(testRRect, testPaint)) |
297 EXPECT_COPY_ON_WRITE(drawPath(testPath, testPaint)) | 293 EXPECT_COPY_ON_WRITE(drawPath(testPath, testPaint)) |
298 EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0)) | 294 EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0)) |
299 EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, NULL, testRect)) | 295 EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, NULL, testRect)) |
300 EXPECT_COPY_ON_WRITE(drawBitmapMatrix(testBitmap, testMatrix, NULL)) | |
301 EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, NULL)) | 296 EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, NULL)) |
302 EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, NULL)) | 297 EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, NULL)) |
303 EXPECT_COPY_ON_WRITE(drawText(testText.c_str(), testText.size(), 0, 1, testP
aint)) | 298 EXPECT_COPY_ON_WRITE(drawText(testText.c_str(), testText.size(), 0, 1, testP
aint)) |
304 EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoin
ts2, \ | 299 EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoin
ts2, \ |
305 testPaint)) | 300 testPaint)) |
306 EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testP
ath, NULL, \ | 301 EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testP
ath, NULL, \ |
307 testPaint)) | 302 testPaint)) |
308 } | 303 } |
309 | 304 |
310 static void TestSurfaceWritableAfterSnapshotRelease(skiatest::Reporter* reporter
, | 305 static void TestSurfaceWritableAfterSnapshotRelease(skiatest::Reporter* reporter
, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kDiscard_ContentChangeMode); | 431 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kDiscard_ContentChangeMode); |
437 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa
ce::kRetain_ContentChangeMode); | 432 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa
ce::kRetain_ContentChangeMode); |
438 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); | 433 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); |
439 TestGetTexture(reporter, kGpu_SurfaceType, context); | 434 TestGetTexture(reporter, kGpu_SurfaceType, context); |
440 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 435 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
441 } | 436 } |
442 } | 437 } |
443 } | 438 } |
444 #endif | 439 #endif |
445 } | 440 } |
OLD | NEW |