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

Side by Side Diff: src/utils/SkDeferredCanvas.cpp

Issue 705633002: Revert of Override SkCanvas::drawImage() in SkDeferredCanvas and SkGPipe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/pipe/SkGPipeWrite.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkDeferredCanvas.h" 9 #include "SkDeferredCanvas.h"
10 10
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 void SkDeferredCanvas::drawBitmapNine(const SkBitmap& bitmap, 859 void SkDeferredCanvas::drawBitmapNine(const SkBitmap& bitmap,
860 const SkIRect& center, const SkRect& dst, 860 const SkIRect& center, const SkRect& dst,
861 const SkPaint* paint) { 861 const SkPaint* paint) {
862 // TODO: reset recording canvas if paint+bitmap is opaque and clip rect 862 // TODO: reset recording canvas if paint+bitmap is opaque and clip rect
863 // covers canvas entirely and dst covers canvas entirely 863 // covers canvas entirely and dst covers canvas entirely
864 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint); 864 AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint);
865 this->drawingCanvas()->drawBitmapNine(bitmap, center, dst, paint); 865 this->drawingCanvas()->drawBitmapNine(bitmap, center, dst, paint);
866 this->recordedDrawCommand(); 866 this->recordedDrawCommand();
867 } 867 }
868 868
869 void SkDeferredCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar t op,
870 const SkPaint* paint) {
871 SkRect imageRect = SkRect::MakeXYWH(left, top,
872 SkIntToScalar(image->width()), SkIntToScalar(image->height()));
873 bool isImageOpaque = image->isOpaque();
874 SkPaintBitmapOpacity pct = isImageOpaque
875 ? kOpaque_SkPaintBitmapOpacity : kUnknown_SkPaintBitmapOpacity;
876
877 if (fDeferredDrawing &&
878 this->isFullFrame(&imageRect, paint) &&
879 (isImageOpaque ||isPaintOpaque(paint, pct))) {
880 this->getDeferredDevice()->skipPendingCommands();
881 }
882
883 AutoImmediateDrawIfNeeded autoDraw(*this, paint);
884 this->drawingCanvas()->drawImage(image, left, top, paint);
885 this->recordedDrawCommand();
886 }
887
888 void SkDeferredCanvas::drawImageRect(const SkImage* image, const SkRect* src,
889 const SkRect& dst,
890 const SkPaint* paint) {
891 bool isImageOpaque = image->isOpaque();
892 SkPaintBitmapOpacity pct = isImageOpaque
893 ? kOpaque_SkPaintBitmapOpacity : kUnknown_SkPaintBitmapOpacity;
894
895 if (fDeferredDrawing &&
896 this->isFullFrame(&dst, paint) &&
897 (isImageOpaque || isPaintOpaque(paint, pct))) {
898 this->getDeferredDevice()->skipPendingCommands();
899 }
900
901 AutoImmediateDrawIfNeeded autoDraw(*this, paint);
902 this->drawingCanvas()->drawImageRect(image, src, dst, paint);
903 this->recordedDrawCommand();
904 }
905
906 void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, 869 void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
907 const SkPaint* paint) { 870 const SkPaint* paint) {
908 SkRect bitmapRect = SkRect::MakeXYWH( 871 SkRect bitmapRect = SkRect::MakeXYWH(
909 SkIntToScalar(left), 872 SkIntToScalar(left),
910 SkIntToScalar(top), 873 SkIntToScalar(top),
911 SkIntToScalar(bitmap.width()), 874 SkIntToScalar(bitmap.width()),
912 SkIntToScalar(bitmap.height())); 875 SkIntToScalar(bitmap.height()));
913 if (fDeferredDrawing && 876 if (fDeferredDrawing &&
914 this->isFullFrame(&bitmapRect, paint) && 877 this->isFullFrame(&bitmapRect, paint) &&
915 isPaintOpaque(paint, &bitmap)) { 878 isPaintOpaque(paint, &bitmap)) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 948 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
986 this->drawingCanvas()->setDrawFilter(filter); 949 this->drawingCanvas()->setDrawFilter(filter);
987 this->INHERITED::setDrawFilter(filter); 950 this->INHERITED::setDrawFilter(filter);
988 this->recordedDrawCommand(); 951 this->recordedDrawCommand();
989 return filter; 952 return filter;
990 } 953 }
991 954
992 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 955 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
993 return this->drawingCanvas(); 956 return this->drawingCanvas();
994 } 957 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698