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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 1191943002: Add useDFT field to SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 6 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/gpu/GrStencilAndCoverTextContext.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 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, int width, int height, 129 SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, int width, int height,
130 const SkSurfaceProps* props, unsigned flags) { 130 const SkSurfaceProps* props, unsigned flags) {
131 if (!rt || rt->wasDestroyed()) { 131 if (!rt || rt->wasDestroyed()) {
132 return NULL; 132 return NULL;
133 } 133 }
134 return SkNEW_ARGS(SkGpuDevice, (rt, width, height, props, flags)); 134 return SkNEW_ARGS(SkGpuDevice, (rt, width, height, props, flags));
135 } 135 }
136 136
137 static SkDeviceProperties surfaceprops_to_deviceprops(const SkSurfaceProps* prop s) { 137 static SkDeviceProperties surfaceprops_to_deviceprops(const SkSurfaceProps* prop s) {
138 if (props) { 138 if (props) {
139 return SkDeviceProperties(props->pixelGeometry()); 139 return SkDeviceProperties(props->pixelGeometry(), props->isUseDistanceFi eldFonts());
140 } else { 140 } else {
141 return SkDeviceProperties(); 141 return SkDeviceProperties();
142 } 142 }
143 } 143 }
144 144
145 static SkSurfaceProps copy_or_default_props(const SkSurfaceProps* props) { 145 static SkSurfaceProps copy_or_default_props(const SkSurfaceProps* props) {
146 if (props) { 146 if (props) {
147 return SkSurfaceProps(*props); 147 return SkSurfaceProps(*props);
148 } else { 148 } else {
149 return SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType); 149 return SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
(...skipping 10 matching lines...) Expand all
160 fContext = SkRef(rt->getContext()); 160 fContext = SkRef(rt->getContext());
161 fNeedClear = flags & kNeedClear_Flag; 161 fNeedClear = flags & kNeedClear_Flag;
162 162
163 fRenderTarget = SkRef(rt); 163 fRenderTarget = SkRef(rt);
164 164
165 SkImageInfo info = rt->surfacePriv().info().makeWH(width, height); 165 SkImageInfo info = rt->surfacePriv().info().makeWH(width, height);
166 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt)); 166 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt));
167 fLegacyBitmap.setInfo(info); 167 fLegacyBitmap.setInfo(info);
168 fLegacyBitmap.setPixelRef(pr)->unref(); 168 fLegacyBitmap.setPixelRef(pr)->unref();
169 169
170 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); 170 fDrawContext.reset(SkRef(fContext->drawContext(&this->getLeakyProperties())) );
171 fDrawContext.reset(SkRef(fContext->drawContext(&this->getLeakyProperties(), useDFT)));
172 } 171 }
173 172
174 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B udgeted budgeted, 173 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B udgeted budgeted,
175 const SkImageInfo& origInfo, int sampleCount) { 174 const SkImageInfo& origInfo, int sampleCount) {
176 if (kUnknown_SkColorType == origInfo.colorType() || 175 if (kUnknown_SkColorType == origInfo.colorType() ||
177 origInfo.width() < 0 || origInfo.height() < 0) { 176 origInfo.width() < 0 || origInfo.height() < 0) {
178 return NULL; 177 return NULL;
179 } 178 }
180 179
181 if (!context) { 180 if (!context) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 345
347 SkASSERT(fRenderTarget != newRT); 346 SkASSERT(fRenderTarget != newRT);
348 347
349 fRenderTarget->unref(); 348 fRenderTarget->unref();
350 fRenderTarget = newRT.detach(); 349 fRenderTarget = newRT.detach();
351 350
352 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info()); 351 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info());
353 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info (), fRenderTarget)); 352 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info (), fRenderTarget));
354 fLegacyBitmap.setPixelRef(pr)->unref(); 353 fLegacyBitmap.setPixelRef(pr)->unref();
355 354
356 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); 355 fDrawContext.reset(SkRef(fRenderTarget->getContext()->drawContext(&this->get LeakyProperties())));
357 fDrawContext.reset(SkRef(fRenderTarget->getContext()->drawContext(&this->get LeakyProperties(),
358 useDFT)));
359 } 356 }
360 357
361 /////////////////////////////////////////////////////////////////////////////// 358 ///////////////////////////////////////////////////////////////////////////////
362 359
363 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 360 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
364 CHECK_SHOULD_DRAW(draw); 361 CHECK_SHOULD_DRAW(draw);
365 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); 362 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext);
366 363
367 GrPaint grPaint; 364 GrPaint grPaint;
368 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 365 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) {
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 #endif 1786 #endif
1790 } 1787 }
1791 1788
1792 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1789 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1793 // We always return a transient cache, so it is freed after each 1790 // We always return a transient cache, so it is freed after each
1794 // filter traversal. 1791 // filter traversal.
1795 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1792 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1796 } 1793 }
1797 1794
1798 #endif 1795 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698