| 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkCachingPixelRef.h" | 9 #include "SkCachingPixelRef.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkData.h" | 11 #include "SkData.h" |
| 12 #include "SkDecodingImageGenerator.h" | 12 #include "SkDecodingImageGenerator.h" |
| 13 #include "SkDiscardableMemoryPool.h" | 13 #include "SkDiscardableMemoryPool.h" |
| 14 #include "SkImageDecoder.h" | 14 #include "SkImageDecoder.h" |
| 15 #include "SkImageGeneratorPriv.h" | 15 #include "SkImageGeneratorPriv.h" |
| 16 #include "SkScaledImageCache.h" | 16 #include "SkScaledImageCache.h" |
| 17 #include "SkStream.h" | 17 #include "SkStream.h" |
| 18 #include "SkUtils.h" | 18 #include "SkUtils.h" |
| 19 | 19 |
| 20 #include "Test.h" | 20 #include "Test.h" |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Fill this bitmap with some color. | 23 * Fill this bitmap with some color. |
| 24 */ | 24 */ |
| 25 static void make_test_image(SkBitmap* bm) { | 25 static void make_test_image(SkBitmap* bm) { |
| 26 static const int W = 50, H = 50; | 26 const int W = 50, H = 50; |
| 27 static const SkBitmap::Config config = SkBitmap::kARGB_8888_Config; | 27 bm->allocN32Pixels(W, H); |
| 28 bm->setConfig(config, W, H); | |
| 29 bm->allocPixels(); | |
| 30 bm->eraseColor(SK_ColorBLACK); | 28 bm->eraseColor(SK_ColorBLACK); |
| 31 SkCanvas canvas(*bm); | 29 SkCanvas canvas(*bm); |
| 32 SkPaint paint; | 30 SkPaint paint; |
| 33 paint.setColor(SK_ColorBLUE); | 31 paint.setColor(SK_ColorBLUE); |
| 34 canvas.drawRectCoords(0, 0, SkIntToScalar(W/2), | 32 canvas.drawRectCoords(0, 0, SkIntToScalar(W/2), |
| 35 SkIntToScalar(H/2), paint); | 33 SkIntToScalar(H/2), paint); |
| 36 paint.setColor(SK_ColorWHITE); | 34 paint.setColor(SK_ColorWHITE); |
| 37 canvas.drawRectCoords(SkIntToScalar(W/2), SkIntToScalar(H/2), | 35 canvas.drawRectCoords(SkIntToScalar(W/2), SkIntToScalar(H/2), |
| 38 SkIntToScalar(W), SkIntToScalar(H), paint); | 36 SkIntToScalar(W), SkIntToScalar(H), paint); |
| 39 } | 37 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 315 |
| 318 SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool(); | 316 SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool(); |
| 319 // Only acts differently from NULL on a platform that has a | 317 // Only acts differently from NULL on a platform that has a |
| 320 // default discardable memory implementation that differs from the | 318 // default discardable memory implementation that differs from the |
| 321 // global DM pool. | 319 // global DM pool. |
| 322 check_pixelref(TestImageGenerator::kFailGetPixels_TestType, | 320 check_pixelref(TestImageGenerator::kFailGetPixels_TestType, |
| 323 reporter, kSkDiscardable_PixelRefType, globalPool); | 321 reporter, kSkDiscardable_PixelRefType, globalPool); |
| 324 check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, | 322 check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, |
| 325 reporter, kSkDiscardable_PixelRefType, globalPool); | 323 reporter, kSkDiscardable_PixelRefType, globalPool); |
| 326 } | 324 } |
| OLD | NEW |