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

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

Issue 1239193002: remove all guards for changes to drawBitmapRect / drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 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/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.h » ('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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 SkIntToScalar(w), 1374 SkIntToScalar(w),
1375 SkIntToScalar(h)), 1375 SkIntToScalar(h)),
1376 SkRect::MakeXYWH(0, 1376 SkRect::MakeXYWH(0,
1377 0, 1377 0,
1378 SK_Scalar1 * w / texture- >width(), 1378 SK_Scalar1 * w / texture- >width(),
1379 SK_Scalar1 * h / texture- >height())); 1379 SK_Scalar1 * h / texture- >height()));
1380 } 1380 }
1381 1381
1382 void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap, 1382 void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap,
1383 const SkRect* src, const SkRect& dst, 1383 const SkRect* src, const SkRect& dst,
1384 const SkPaint& paint, 1384 const SkPaint& paint, SkCanvas::SrcRectConstrai nt constraint) {
1385 SK_VIRTUAL_CONSTRAINT_TYPE legacyConstraint) {
1386 SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstraint)legacy Constraint;
1387
1388 SkMatrix matrix; 1385 SkMatrix matrix;
1389 SkRect bitmapBounds, tmpSrc; 1386 SkRect bitmapBounds, tmpSrc;
1390 1387
1391 bitmapBounds.set(0, 0, 1388 bitmapBounds.set(0, 0,
1392 SkIntToScalar(bitmap.width()), 1389 SkIntToScalar(bitmap.width()),
1393 SkIntToScalar(bitmap.height())); 1390 SkIntToScalar(bitmap.height()));
1394 1391
1395 // Compute matrix from the two rectangles 1392 // Compute matrix from the two rectangles
1396 if (src) { 1393 if (src) {
1397 tmpSrc = *src; 1394 tmpSrc = *src;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 if (wrap_as_bm(image, &bm)) { 1539 if (wrap_as_bm(image, &bm)) {
1543 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); 1540 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint);
1544 } 1541 }
1545 } 1542 }
1546 1543
1547 void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src, 1544 void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src,
1548 const SkRect& dst, const SkPaint& paint, 1545 const SkRect& dst, const SkPaint& paint,
1549 SkCanvas::SrcRectConstraint constraint) { 1546 SkCanvas::SrcRectConstraint constraint) {
1550 SkBitmap bm; 1547 SkBitmap bm;
1551 if (wrap_as_bm(image, &bm)) { 1548 if (wrap_as_bm(image, &bm)) {
1552 this->drawBitmapRect(draw, bm, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_T YPE)constraint); 1549 this->drawBitmapRect(draw, bm, src, dst, paint, constraint);
1553 } 1550 }
1554 } 1551 }
1555 1552
1556 /////////////////////////////////////////////////////////////////////////////// 1553 ///////////////////////////////////////////////////////////////////////////////
1557 1554
1558 // must be in SkCanvas::VertexMode order 1555 // must be in SkCanvas::VertexMode order
1559 static const GrPrimitiveType gVertexMode2PrimitiveType[] = { 1556 static const GrPrimitiveType gVertexMode2PrimitiveType[] = {
1560 kTriangles_GrPrimitiveType, 1557 kTriangles_GrPrimitiveType,
1561 kTriangleStrip_GrPrimitiveType, 1558 kTriangleStrip_GrPrimitiveType,
1562 kTriangleFan_GrPrimitiveType, 1559 kTriangleFan_GrPrimitiveType,
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 #endif 1897 #endif
1901 } 1898 }
1902 1899
1903 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1900 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1904 // We always return a transient cache, so it is freed after each 1901 // We always return a transient cache, so it is freed after each
1905 // filter traversal. 1902 // filter traversal.
1906 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1903 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1907 } 1904 }
1908 1905
1909 #endif 1906 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698