OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkSpecialImage.h" | 10 #include "SkSpecialImage.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) { | 75 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) { |
76 GrContext* context = ctxInfo.grContext(); | 76 GrContext* context = ctxInfo.grContext(); |
77 | 77 |
78 static const int kWidth = 100; | 78 static const int kWidth = 100; |
79 static const int kHeight = 90; | 79 static const int kHeight = 90; |
80 | 80 |
81 SkImageInfo ii = SkImageInfo::MakeN32Premul(2*kWidth, 2*kHeight); | 81 SkImageInfo ii = SkImageInfo::MakeN32Premul(2*kWidth, 2*kHeight); |
82 | 82 |
83 sk_sp<SkBaseDevice> gpuDev(SkGpuDevice::Make(context, SkBudgeted::kNo, ii, | 83 sk_sp<SkBaseDevice> gpuDev(SkGpuDevice::Make(context, SkBudgeted::kNo, ii, |
84 0, nullptr, SkGpuDevice::kClear
_InitContents)); | 84 0, kBottomLeft_GrSurfaceOrigin,
nullptr, |
| 85 SkGpuDevice::kClear_InitContent
s)); |
85 | 86 |
86 SkBitmap bm; | 87 SkBitmap bm; |
87 SkAssertResult(bm.tryAllocN32Pixels(kWidth, kHeight)); | 88 SkAssertResult(bm.tryAllocN32Pixels(kWidth, kHeight)); |
88 | 89 |
89 // Create a gpu-backed special image from a raster-backed SkBitmap | 90 // Create a gpu-backed special image from a raster-backed SkBitmap |
90 sk_sp<SkSpecialImage> special = DeviceTestingAccess::MakeSpecial(gpuDev.get(
), bm); | 91 sk_sp<SkSpecialImage> special = DeviceTestingAccess::MakeSpecial(gpuDev.get(
), bm); |
91 SkASSERT(special->isTextureBacked()); | 92 SkASSERT(special->isTextureBacked()); |
92 SkASSERT(kWidth == special->width()); | 93 SkASSERT(kWidth == special->width()); |
93 SkASSERT(kHeight == special->height()); | 94 SkASSERT(kHeight == special->height()); |
94 SkASSERT(bm.getGenerationID() == special->uniqueID()); | 95 SkASSERT(bm.getGenerationID() == special->uniqueID()); |
(...skipping 20 matching lines...) Expand all Loading... |
115 | 116 |
116 // Snap the device as a gpu-backed special image | 117 // Snap the device as a gpu-backed special image |
117 special = DeviceTestingAccess::SnapSpecial(gpuDev.get()); | 118 special = DeviceTestingAccess::SnapSpecial(gpuDev.get()); |
118 SkASSERT(special->isTextureBacked()); | 119 SkASSERT(special->isTextureBacked()); |
119 SkASSERT(2*kWidth == special->width()); | 120 SkASSERT(2*kWidth == special->width()); |
120 SkASSERT(2*kHeight == special->height()); | 121 SkASSERT(2*kHeight == special->height()); |
121 SkASSERT(SkIRect::MakeWH(2*kWidth, 2*kHeight) == special->subset()); | 122 SkASSERT(SkIRect::MakeWH(2*kWidth, 2*kHeight) == special->subset()); |
122 } | 123 } |
123 | 124 |
124 #endif | 125 #endif |
OLD | NEW |