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

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

Issue 658293004: Revert of Override SkCanvas::drawImage() in SkDeferredCanvas and SkGPipe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/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 if (fDeferredDrawing &&
874 this->isFullFrame(&imageRect, paint) &&
875 (image->isOpaque() || isPaintOpaque(paint, 0))) {
876 this->getDeferredDevice()->skipPendingCommands();
877 }
878
879 AutoImmediateDrawIfNeeded autoDraw(*this, paint);
880 this->drawingCanvas()->drawImage(image, left, top, paint);
881 this->recordedDrawCommand();
882 }
883
884 void SkDeferredCanvas::drawImageRect(const SkImage* image, const SkRect* src,
885 const SkRect& dst,
886 const SkPaint* paint) {
887 if (fDeferredDrawing &&
888 this->isFullFrame(&dst, paint) &&
889 (image->isOpaque() || isPaintOpaque(paint, 0))) {
890 this->getDeferredDevice()->skipPendingCommands();
891 }
892
893 AutoImmediateDrawIfNeeded autoDraw(*this, paint);
894 this->drawingCanvas()->drawImageRect(image, src, dst, paint);
895 this->recordedDrawCommand();
896 }
897
898 void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, 869 void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
899 const SkPaint* paint) { 870 const SkPaint* paint) {
900 SkRect bitmapRect = SkRect::MakeXYWH( 871 SkRect bitmapRect = SkRect::MakeXYWH(
901 SkIntToScalar(left), 872 SkIntToScalar(left),
902 SkIntToScalar(top), 873 SkIntToScalar(top),
903 SkIntToScalar(bitmap.width()), 874 SkIntToScalar(bitmap.width()),
904 SkIntToScalar(bitmap.height())); 875 SkIntToScalar(bitmap.height()));
905 if (fDeferredDrawing && 876 if (fDeferredDrawing &&
906 this->isFullFrame(&bitmapRect, paint) && 877 this->isFullFrame(&bitmapRect, paint) &&
907 isPaintOpaque(paint, &bitmap)) { 878 isPaintOpaque(paint, &bitmap)) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 948 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
978 this->drawingCanvas()->setDrawFilter(filter); 949 this->drawingCanvas()->setDrawFilter(filter);
979 this->INHERITED::setDrawFilter(filter); 950 this->INHERITED::setDrawFilter(filter);
980 this->recordedDrawCommand(); 951 this->recordedDrawCommand();
981 return filter; 952 return filter;
982 } 953 }
983 954
984 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 955 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
985 return this->drawingCanvas(); 956 return this->drawingCanvas();
986 } 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