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

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

Issue 1336413006: Just an experiment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 3 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/gpu/batches/GrAAFillRectBatch.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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 usePath = true; 500 usePath = true;
501 } 501 }
502 502
503 GrStrokeInfo strokeInfo(paint); 503 GrStrokeInfo strokeInfo(paint);
504 504
505 const SkPathEffect* pe = paint.getPathEffect(); 505 const SkPathEffect* pe = paint.getPathEffect();
506 if (!usePath && pe && !strokeInfo.isDashed()) { 506 if (!usePath && pe && !strokeInfo.isDashed()) {
507 usePath = true; 507 usePath = true;
508 } 508 }
509 509
510 if (strokeInfo.isDashed()) {
511 usePath = true;
512 }
513
510 if (usePath) { 514 if (usePath) {
511 SkPath path; 515 SkPath path;
512 path.setIsVolatile(true); 516 path.setIsVolatile(true);
513 path.addRect(rect); 517 path.addRect(rect);
514 this->drawPath(draw, path, paint, nullptr, true); 518 this->drawPath(draw, path, paint, nullptr, true);
515 return; 519 return;
516 } 520 }
517 521
518 GrPaint grPaint; 522 GrDrawRect grDraw(fRenderTarget, fContext, fClip, paint, *draw.fMatrix, rect , &strokeInfo);
519 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 523 fDrawContext->draw(grDraw);
520 return;
521 }
522
523 fDrawContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, & strokeInfo);
524 } 524 }
525 525
526 /////////////////////////////////////////////////////////////////////////////// 526 ///////////////////////////////////////////////////////////////////////////////
527 527
528 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, 528 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
529 const SkPaint& paint) { 529 const SkPaint& paint) {
530 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext); 530 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext);
531 CHECK_FOR_ANNOTATION(paint); 531 CHECK_FOR_ANNOTATION(paint);
532 CHECK_SHOULD_DRAW(draw); 532 CHECK_SHOULD_DRAW(draw);
533 533
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 if (!SkPaint2GrPaintNoShader(context, renderTarget, paint, SkColor2GrColor(p aint.getColor()), 1014 if (!SkPaint2GrPaintNoShader(context, renderTarget, paint, SkColor2GrColor(p aint.getColor()),
1015 false, &grPaint)) { 1015 false, &grPaint)) {
1016 return; 1016 return;
1017 } 1017 }
1018 1018
1019 grPaint.setColor(paintColor); 1019 grPaint.setColor(paintColor);
1020 1020
1021 // Setup dst rect and final matrix 1021 // Setup dst rect and final matrix
1022 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize.fHeight}; 1022 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize.fHeight};
1023 1023
1024 SkRect devRect;
1025 viewMatrix.mapRect(&devRect, dstRect);
1026
1027 SkMatrix matrix; 1024 SkMatrix matrix;
1028 matrix.setIDiv(bitmapPtr->width(), bitmapPtr->height()); 1025 matrix.setIDiv(bitmapPtr->width(), bitmapPtr->height());
1029 1026
1030 SkMatrix dstRectToSrcRect; 1027 SkMatrix dstRectToSrcRect;
1031 if (!srcRectToDstRect.invert(&dstRectToSrcRect)) { 1028 if (!srcRectToDstRect.invert(&dstRectToSrcRect)) {
1032 return; 1029 return;
1033 } 1030 }
1034 matrix.preConcat(dstRectToSrcRect); 1031 matrix.preConcat(dstRectToSrcRect);
1035 1032
1036 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill(grPaint.get Color(), 1033 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill(grPaint.get Color(),
1037 viewMatrix, 1034 viewMatrix,
1038 matrix, 1035 matrix,
1039 dstRect, 1036 dstRect));
1040 devRect));
1041 1037
1042 drawContext->drawBatch(renderTarget, clip, grPaint, batch); 1038 drawContext->drawBatch(renderTarget, clip, grPaint, batch);
1043 } 1039 }
1044 1040
1045 static bool can_ignore_strict_subset_constraint(const SkBitmap& bitmap, const Sk Rect& subset) { 1041 static bool can_ignore_strict_subset_constraint(const SkBitmap& bitmap, const Sk Rect& subset) {
1046 GrTexture* tex = bitmap.getTexture(); 1042 GrTexture* tex = bitmap.getTexture();
1047 int width = tex ? tex->width() : bitmap.width(); 1043 int width = tex ? tex->width() : bitmap.width();
1048 int height = tex ? tex->height() : bitmap.height(); 1044 int height = tex ? tex->height() : bitmap.height();
1049 return subset.contains(SkRect::MakeIWH(width, height)); 1045 return subset.contains(SkRect::MakeIWH(width, height));
1050 } 1046 }
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 #endif 1974 #endif
1979 } 1975 }
1980 1976
1981 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1977 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1982 // We always return a transient cache, so it is freed after each 1978 // We always return a transient cache, so it is freed after each
1983 // filter traversal. 1979 // filter traversal.
1984 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1980 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1985 } 1981 }
1986 1982
1987 #endif 1983 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/batches/GrAAFillRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698