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

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

Issue 1418473004: Allow max tile size to be overridden separately from max texture size. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comment spelling Created 5 years, 1 month 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/GrCaps.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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 int tileFilterPad; 820 int tileFilterPad;
821 if (doBicubic) { 821 if (doBicubic) {
822 tileFilterPad = GrBicubicEffect::kFilterTexelPad; 822 tileFilterPad = GrBicubicEffect::kFilterTexelPad;
823 } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) { 823 } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) {
824 tileFilterPad = 0; 824 tileFilterPad = 0;
825 } else { 825 } else {
826 tileFilterPad = 1; 826 tileFilterPad = 1;
827 } 827 }
828 params.setFilterMode(textureFilterMode); 828 params.setFilterMode(textureFilterMode);
829 829
830 int maxTileSize = fContext->caps()->maxTextureSize() - 2 * tileFilterPad; 830 int maxTileSize = fContext->caps()->maxTileSize() - 2 * tileFilterPad;
831 831
832 // these are output, which we safely ignore, as we just want to know the pre dicate 832 // these are output, which we safely ignore, as we just want to know the pre dicate
833 int outTileSize; 833 int outTileSize;
834 SkIRect outClippedSrcRect; 834 SkIRect outClippedSrcRect;
835 835
836 return this->shouldTileImageID(image->unique(), image->bounds(), viewMatrix, params, srcRectPtr, 836 return this->shouldTileImageID(image->unique(), image->bounds(), viewMatrix, params, srcRectPtr,
837 maxTileSize, &outTileSize, &outClippedSrcRect ); 837 maxTileSize, &outTileSize, &outClippedSrcRect );
838 } 838 }
839 839
840 void SkGpuDevice::drawBitmap(const SkDraw& origDraw, 840 void SkGpuDevice::drawBitmap(const SkDraw& origDraw,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 1064
1065 if (can_ignore_strict_subset_constraint(bitmap, srcRect)) { 1065 if (can_ignore_strict_subset_constraint(bitmap, srcRect)) {
1066 constraint = SkCanvas::kFast_SrcRectConstraint; 1066 constraint = SkCanvas::kFast_SrcRectConstraint;
1067 } 1067 }
1068 1068
1069 // If the render target is not msaa and draw is antialiased, we call 1069 // If the render target is not msaa and draw is antialiased, we call
1070 // drawRect instead of drawing on the render target directly. 1070 // drawRect instead of drawing on the render target directly.
1071 // FIXME: the tiled bitmap code path doesn't currently support 1071 // FIXME: the tiled bitmap code path doesn't currently support
1072 // anti-aliased edges, we work around that for now by drawing directly 1072 // anti-aliased edges, we work around that for now by drawing directly
1073 // if the image size exceeds maximum texture size. 1073 // if the image size exceeds maximum texture size.
1074 int maxTextureSize = fContext->caps()->maxTextureSize(); 1074 int maxTileSize = fContext->caps()->maxTileSize();
1075 bool drawAA = !fRenderTarget->isUnifiedMultisampled() && 1075 bool drawAA = !fRenderTarget->isUnifiedMultisampled() &&
1076 paint.isAntiAlias() && 1076 paint.isAntiAlias() &&
1077 bitmap.width() <= maxTextureSize && 1077 bitmap.width() <= maxTileSize &&
1078 bitmap.height() <= maxTextureSize; 1078 bitmap.height() <= maxTileSize;
1079 1079
1080 if (paint.getMaskFilter() || drawAA) { 1080 if (paint.getMaskFilter() || drawAA) {
1081 // Convert the bitmap to a shader so that the rect can be drawn 1081 // Convert the bitmap to a shader so that the rect can be drawn
1082 // through drawRect, which supports mask filters. 1082 // through drawRect, which supports mask filters.
1083 SkBitmap tmp; // subset of bitmap, if necessary 1083 SkBitmap tmp; // subset of bitmap, if necessary
1084 const SkBitmap* bitmapPtr = &bitmap; 1084 const SkBitmap* bitmapPtr = &bitmap;
1085 SkMatrix srcRectToDstRect; 1085 SkMatrix srcRectToDstRect;
1086 if (srcRectPtr) { 1086 if (srcRectPtr) {
1087 srcRectToDstRect.setTranslate(-srcRectPtr->fLeft, -srcRectPtr->fTop) ; 1087 srcRectToDstRect.setTranslate(-srcRectPtr->fLeft, -srcRectPtr->fTop) ;
1088 srcRectToDstRect.postScale(dstSize.fWidth / srcRectPtr->width(), 1088 srcRectToDstRect.postScale(dstSize.fWidth / srcRectPtr->width(),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 int tileFilterPad; 1143 int tileFilterPad;
1144 if (doBicubic) { 1144 if (doBicubic) {
1145 tileFilterPad = GrBicubicEffect::kFilterTexelPad; 1145 tileFilterPad = GrBicubicEffect::kFilterTexelPad;
1146 } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) { 1146 } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) {
1147 tileFilterPad = 0; 1147 tileFilterPad = 0;
1148 } else { 1148 } else {
1149 tileFilterPad = 1; 1149 tileFilterPad = 1;
1150 } 1150 }
1151 params.setFilterMode(textureFilterMode); 1151 params.setFilterMode(textureFilterMode);
1152 1152
1153 int maxTileSize = fContext->caps()->maxTextureSize() - 2 * tileFilterPad; 1153 maxTileSize = fContext->caps()->maxTileSize() - 2 * tileFilterPad;
1154 int tileSize; 1154 int tileSize;
1155 1155
1156 SkIRect clippedSrcRect; 1156 SkIRect clippedSrcRect;
1157 if (this->shouldTileBitmap(bitmap, viewM, params, srcRectPtr, maxTileSize, & tileSize, 1157 if (this->shouldTileBitmap(bitmap, viewM, params, srcRectPtr, maxTileSize, & tileSize,
1158 &clippedSrcRect)) { 1158 &clippedSrcRect)) {
1159 this->drawTiledBitmap(bitmap, viewM, srcRect, clippedSrcRect, params, pa int, constraint, 1159 this->drawTiledBitmap(bitmap, viewM, srcRect, clippedSrcRect, params, pa int, constraint,
1160 tileSize, doBicubic); 1160 tileSize, doBicubic);
1161 } else { 1161 } else {
1162 // take the simple case 1162 // take the simple case
1163 bool needsTextureDomain = needs_texture_domain(bitmap, 1163 bool needsTextureDomain = needs_texture_domain(bitmap,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 * and that non-texture portion of the GrPaint has already been setup. 1272 * and that non-texture portion of the GrPaint has already been setup.
1273 */ 1273 */
1274 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, 1274 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
1275 const SkMatrix& viewMatrix, 1275 const SkMatrix& viewMatrix,
1276 const SkRect& srcRect, 1276 const SkRect& srcRect,
1277 const GrTextureParams& params, 1277 const GrTextureParams& params,
1278 const SkPaint& paint, 1278 const SkPaint& paint,
1279 SkCanvas::SrcRectConstraint constraint, 1279 SkCanvas::SrcRectConstraint constraint,
1280 bool bicubic, 1280 bool bicubic,
1281 bool needsTextureDomain) { 1281 bool needsTextureDomain) {
1282 SkASSERT(bitmap.width() <= fContext->caps()->maxTextureSize() && 1282 SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() &&
1283 bitmap.height() <= fContext->caps()->maxTextureSize()); 1283 bitmap.height() <= fContext->caps()->maxTileSize());
1284 1284
1285 GrTexture* texture; 1285 GrTexture* texture;
1286 AutoBitmapTexture abt(fContext, bitmap, params, &texture); 1286 AutoBitmapTexture abt(fContext, bitmap, params, &texture);
1287 if (nullptr == texture) { 1287 if (nullptr == texture) {
1288 return; 1288 return;
1289 } 1289 }
1290 1290
1291 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() }; 1291 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() };
1292 SkRect paintRect; 1292 SkRect paintRect;
1293 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width())); 1293 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width()));
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 2019 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
2020 } 2020 }
2021 2021
2022 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 2022 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
2023 // We always return a transient cache, so it is freed after each 2023 // We always return a transient cache, so it is freed after each
2024 // filter traversal. 2024 // filter traversal.
2025 return SkGpuDevice::NewImageFilterCache(); 2025 return SkGpuDevice::NewImageFilterCache();
2026 } 2026 }
2027 2027
2028 #endif 2028 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrCaps.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698