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

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 248473006: stop using deprecated bitmap::config for gpu (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/effects/GrTextureStripAtlas.cpp ('k') | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return NULL; 103 return NULL;
104 } 104 }
105 return SkNEW_ARGS(SkSurface_Gpu, (target, false)); 105 return SkNEW_ARGS(SkSurface_Gpu, (target, false));
106 } 106 }
107 107
108 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImageInfo& info, i nt sampleCount) { 108 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImageInfo& info, i nt sampleCount) {
109 if (NULL == ctx) { 109 if (NULL == ctx) {
110 return NULL; 110 return NULL;
111 } 111 }
112 112
113 SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
114
115 GrTextureDesc desc; 113 GrTextureDesc desc;
116 desc.fFlags = kRenderTarget_GrTextureFlagBit | kCheckAllocation_GrTextureFla gBit; 114 desc.fFlags = kRenderTarget_GrTextureFlagBit | kCheckAllocation_GrTextureFla gBit;
117 desc.fWidth = info.fWidth; 115 desc.fWidth = info.width();
118 desc.fHeight = info.fHeight; 116 desc.fHeight = info.height();
119 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); 117 desc.fConfig = SkImageInfo2GrPixelConfig(info);
120 desc.fSampleCnt = sampleCount; 118 desc.fSampleCnt = sampleCount;
121 119
122 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); 120 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0));
123 if (NULL == tex) { 121 if (NULL == tex) {
124 return NULL; 122 return NULL;
125 } 123 }
126 124
127 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), false)); 125 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), false));
128 } 126 }
129 127
130 SkSurface* SkSurface::NewScratchRenderTarget(GrContext* ctx, const SkImageInfo& info, int sampleCount) { 128 SkSurface* SkSurface::NewScratchRenderTarget(GrContext* ctx, const SkImageInfo& info, int sampleCount) {
131 if (NULL == ctx) { 129 if (NULL == ctx) {
132 return NULL; 130 return NULL;
133 } 131 }
134 132
135 SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
136
137 GrTextureDesc desc; 133 GrTextureDesc desc;
138 desc.fFlags = kRenderTarget_GrTextureFlagBit | kCheckAllocation_GrTextureFla gBit; 134 desc.fFlags = kRenderTarget_GrTextureFlagBit | kCheckAllocation_GrTextureFla gBit;
139 desc.fWidth = info.fWidth; 135 desc.fWidth = info.width();
140 desc.fHeight = info.fHeight; 136 desc.fHeight = info.height();
141 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); 137 desc.fConfig = SkImageInfo2GrPixelConfig(info);
142 desc.fSampleCnt = sampleCount; 138 desc.fSampleCnt = sampleCount;
143 139
144 SkAutoTUnref<GrTexture> tex(ctx->lockAndRefScratchTexture(desc, GrContext::k Exact_ScratchTexMatch)); 140 SkAutoTUnref<GrTexture> tex(ctx->lockAndRefScratchTexture(desc, GrContext::k Exact_ScratchTexMatch));
145 141
146 if (NULL == tex) { 142 if (NULL == tex) {
147 return NULL; 143 return NULL;
148 } 144 }
149 145
150 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), true)); 146 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), true));
151 } 147 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureStripAtlas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698