| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkConfig8888.h" | 10 #include "SkConfig8888.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256); | 67 const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256); |
| 68 | 68 |
| 69 for (int dtype = 0; dtype < 2; ++dtype) { | 69 for (int dtype = 0; dtype < 2; ++dtype) { |
| 70 | 70 |
| 71 int glCtxTypeCnt = 1; | 71 int glCtxTypeCnt = 1; |
| 72 #if SK_SUPPORT_GPU | 72 #if SK_SUPPORT_GPU |
| 73 if (0 != dtype) { | 73 if (0 != dtype) { |
| 74 glCtxTypeCnt = GrContextFactory::kGLContextTypeCnt; | 74 glCtxTypeCnt = GrContextFactory::kGLContextTypeCnt; |
| 75 } | 75 } |
| 76 #endif | 76 #endif |
| 77 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); |
| 77 for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) { | 78 for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) { |
| 78 SkAutoTUnref<SkBaseDevice> device; | 79 SkAutoTUnref<SkBaseDevice> device; |
| 79 if (0 == dtype) { | 80 if (0 == dtype) { |
| 80 device.reset(SkBitmapDevice::Create(info)); | 81 device.reset(SkBitmapDevice::Create(info, props)); |
| 81 } else { | 82 } else { |
| 82 #if SK_SUPPORT_GPU | 83 #if SK_SUPPORT_GPU |
| 83 GrContextFactory::GLContextType type = | 84 GrContextFactory::GLContextType type = |
| 84 static_cast<GrContextFactory::GLContextType>(glCtxType); | 85 static_cast<GrContextFactory::GLContextType>(glCtxType); |
| 85 if (!GrContextFactory::IsRenderingGLContext(type)) { | 86 if (!GrContextFactory::IsRenderingGLContext(type)) { |
| 86 continue; | 87 continue; |
| 87 } | 88 } |
| 88 GrContext* ctx = factory->get(type); | 89 GrContext* ctx = factory->get(type); |
| 89 if (NULL == ctx) { | 90 if (NULL == ctx) { |
| 90 continue; | 91 continue; |
| 91 } | 92 } |
| 92 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); | |
| 93 device.reset(SkGpuDevice::Create(ctx, SkSurface::kNo_Budgeted, i
nfo, 0, &props)); | 93 device.reset(SkGpuDevice::Create(ctx, SkSurface::kNo_Budgeted, i
nfo, 0, &props)); |
| 94 #else | 94 #else |
| 95 continue; | 95 continue; |
| 96 #endif | 96 #endif |
| 97 } | 97 } |
| 98 SkCanvas canvas(device); | 98 SkCanvas canvas(device); |
| 99 | 99 |
| 100 for (size_t upmaIdx = 0; upmaIdx < SK_ARRAY_COUNT(gUnpremul); ++upma
Idx) { | 100 for (size_t upmaIdx = 0; upmaIdx < SK_ARRAY_COUNT(gUnpremul); ++upma
Idx) { |
| 101 fillCanvas(&canvas, gUnpremul[upmaIdx].fColorType, gUnpremul[upm
aIdx].fPackProc); | 101 fillCanvas(&canvas, gUnpremul[upmaIdx].fColorType, gUnpremul[upm
aIdx].fPackProc); |
| 102 | 102 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 124 if (pixels1[x] != pixels2[x]) { | 124 if (pixels1[x] != pixels2[x]) { |
| 125 SkDebugf("%x != %x, x = %d, y = %d\n", pixels1[x], p
ixels2[x], x, y); | 125 SkDebugf("%x != %x, x = %d, y = %d\n", pixels1[x], p
ixels2[x], x, y); |
| 126 } | 126 } |
| 127 REPORTER_ASSERT(reporter, success = pixels1[x] == pixels
2[x]); | 127 REPORTER_ASSERT(reporter, success = pixels1[x] == pixels
2[x]); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 } | 133 } |
| OLD | NEW |