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

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

Issue 1149773005: Add direct getter for GrCaps to GrContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init caps in the right place 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/GrSWMaskHelper.cpp ('k') | src/gpu/SkGr.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 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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 if (srcRect.fLeft <= 0 && srcRect.fTop <= 0 && 903 if (srcRect.fLeft <= 0 && srcRect.fTop <= 0 &&
904 srcRect.fRight >= width && srcRect.fBottom >= height) { 904 srcRect.fRight >= width && srcRect.fBottom >= height) {
905 flags = (SkCanvas::DrawBitmapRectFlags) (flags | SkCanvas::kBleed_DrawBi tmapRectFlag); 905 flags = (SkCanvas::DrawBitmapRectFlags) (flags | SkCanvas::kBleed_DrawBi tmapRectFlag);
906 } 906 }
907 907
908 // If the render target is not msaa and draw is antialiased, we call 908 // If the render target is not msaa and draw is antialiased, we call
909 // drawRect instead of drawing on the render target directly. 909 // drawRect instead of drawing on the render target directly.
910 // FIXME: the tiled bitmap code path doesn't currently support 910 // FIXME: the tiled bitmap code path doesn't currently support
911 // anti-aliased edges, we work around that for now by drawing directly 911 // anti-aliased edges, we work around that for now by drawing directly
912 // if the image size exceeds maximum texture size. 912 // if the image size exceeds maximum texture size.
913 int maxTextureSize = fContext->getMaxTextureSize(); 913 int maxTextureSize = fContext->caps()->maxTextureSize();
914 bool directDraw = fRenderTarget->isMultisampled() || 914 bool directDraw = fRenderTarget->isMultisampled() ||
915 !paint.isAntiAlias() || 915 !paint.isAntiAlias() ||
916 bitmap.width() > maxTextureSize || 916 bitmap.width() > maxTextureSize ||
917 bitmap.height() > maxTextureSize; 917 bitmap.height() > maxTextureSize;
918 918
919 // we check whether dst rect are pixel aligned 919 // we check whether dst rect are pixel aligned
920 if (!directDraw) { 920 if (!directDraw) {
921 bool staysRect = draw.fMatrix->rectStaysRect(); 921 bool staysRect = draw.fMatrix->rectStaysRect();
922 922
923 if (staysRect) { 923 if (staysRect) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 int tileFilterPad; 1027 int tileFilterPad;
1028 if (doBicubic) { 1028 if (doBicubic) {
1029 tileFilterPad = GrBicubicEffect::kFilterTexelPad; 1029 tileFilterPad = GrBicubicEffect::kFilterTexelPad;
1030 } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) { 1030 } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) {
1031 tileFilterPad = 0; 1031 tileFilterPad = 0;
1032 } else { 1032 } else {
1033 tileFilterPad = 1; 1033 tileFilterPad = 1;
1034 } 1034 }
1035 params.setFilterMode(textureFilterMode); 1035 params.setFilterMode(textureFilterMode);
1036 1036
1037 int maxTileSize = fContext->getMaxTextureSize() - 2 * tileFilterPad; 1037 int maxTileSize = fContext->caps()->maxTextureSize() - 2 * tileFilterPad;
1038 int tileSize; 1038 int tileSize;
1039 1039
1040 SkIRect clippedSrcRect; 1040 SkIRect clippedSrcRect;
1041 if (this->shouldTileBitmap(bitmap, viewM, params, srcRectPtr, maxTileSize, & tileSize, 1041 if (this->shouldTileBitmap(bitmap, viewM, params, srcRectPtr, maxTileSize, & tileSize,
1042 &clippedSrcRect)) { 1042 &clippedSrcRect)) {
1043 this->drawTiledBitmap(bitmap, viewM, srcRect, clippedSrcRect, params, pa int, flags, 1043 this->drawTiledBitmap(bitmap, viewM, srcRect, clippedSrcRect, params, pa int, flags,
1044 tileSize, doBicubic); 1044 tileSize, doBicubic);
1045 } else { 1045 } else {
1046 // take the simple case 1046 // take the simple case
1047 bool needsTextureDomain = needs_texture_domain(bitmap, 1047 bool needsTextureDomain = needs_texture_domain(bitmap,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 * and that non-texture portion of the GrPaint has already been setup. 1156 * and that non-texture portion of the GrPaint has already been setup.
1157 */ 1157 */
1158 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, 1158 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
1159 const SkMatrix& viewMatrix, 1159 const SkMatrix& viewMatrix,
1160 const SkRect& srcRect, 1160 const SkRect& srcRect,
1161 const GrTextureParams& params, 1161 const GrTextureParams& params,
1162 const SkPaint& paint, 1162 const SkPaint& paint,
1163 SkCanvas::DrawBitmapRectFlags flags, 1163 SkCanvas::DrawBitmapRectFlags flags,
1164 bool bicubic, 1164 bool bicubic,
1165 bool needsTextureDomain) { 1165 bool needsTextureDomain) {
1166 SkASSERT(bitmap.width() <= fContext->getMaxTextureSize() && 1166 SkASSERT(bitmap.width() <= fContext->caps()->maxTextureSize() &&
1167 bitmap.height() <= fContext->getMaxTextureSize()); 1167 bitmap.height() <= fContext->caps()->maxTextureSize());
1168 1168
1169 GrTexture* texture; 1169 GrTexture* texture;
1170 AutoBitmapTexture abt(fContext, bitmap, &params, &texture); 1170 AutoBitmapTexture abt(fContext, bitmap, &params, &texture);
1171 if (NULL == texture) { 1171 if (NULL == texture) {
1172 return; 1172 return;
1173 } 1173 }
1174 1174
1175 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() }; 1175 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() };
1176 SkRect paintRect; 1176 SkRect paintRect;
1177 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width())); 1177 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width()));
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 #endif 1792 #endif
1793 } 1793 }
1794 1794
1795 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1795 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1796 // We always return a transient cache, so it is freed after each 1796 // We always return a transient cache, so it is freed after each
1797 // filter traversal. 1797 // filter traversal.
1798 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1798 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1799 } 1799 }
1800 1800
1801 #endif 1801 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698