Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tests/DeviceTest.cpp

Issue 2187573002: Reduce usage of MakeRenderTargetDirect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698