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

Unified Diff: sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 701663002: Remove HTMLVideoElement. (Closed) Base URL: git@github.com:domokit/mojo.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 side-by-side diff with in-line comments
Download patch
Index: sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp b/sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp
index ac9a0bcf7b3ee09282d7168286907a1b29a081af..880ceff162de6151e5a437ecd3bb413e176a749e 100644
--- a/sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -49,7 +49,6 @@
#include "core/html/HTMLCanvasElement.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLMediaElement.h"
-#include "core/html/HTMLVideoElement.h"
#include "core/html/ImageData.h"
#include "core/html/TextMetrics.h"
#include "core/html/canvas/CanvasGradient.h"
@@ -1512,42 +1511,23 @@ void CanvasRenderingContext2D::drawImageInternal(CanvasImageSource* imageSource,
return;
FloatRect dirtyRect = clipBounds;
- if (imageSource->isVideoElement()) {
- // TODO(dshwang): unify video code into below code to composite correctly; crbug.com/407079
- drawVideo(static_cast<HTMLVideoElement*>(imageSource), srcRect, dstRect);
- computeDirtyRect(dstRect, clipBounds, &dirtyRect);
+ if (rectContainsTransformedRect(dstRect, clipBounds)) {
+ c->drawImage(image.get(), dstRect, srcRect, op, blendMode);
+ } else if (isFullCanvasCompositeMode(op)) {
+ fullCanvasCompositedDrawImage(image.get(), dstRect, srcRect, op);
+ } else if (op == CompositeCopy) {
+ clearCanvas();
+ c->drawImage(image.get(), dstRect, srcRect, op, blendMode);
} else {
- if (rectContainsTransformedRect(dstRect, clipBounds)) {
- c->drawImage(image.get(), dstRect, srcRect, op, blendMode);
- } else if (isFullCanvasCompositeMode(op)) {
- fullCanvasCompositedDrawImage(image.get(), dstRect, srcRect, op);
- } else if (op == CompositeCopy) {
- clearCanvas();
- c->drawImage(image.get(), dstRect, srcRect, op, blendMode);
- } else {
- FloatRect dirtyRect;
- computeDirtyRect(dstRect, clipBounds, &dirtyRect);
- c->drawImage(image.get(), dstRect, srcRect, op, blendMode);
- }
-
- if (sourceImageStatus == ExternalSourceImageStatus && isAccelerated() && canvas()->buffer())
- canvas()->buffer()->flush();
+ FloatRect dirtyRect;
+ computeDirtyRect(dstRect, clipBounds, &dirtyRect);
+ c->drawImage(image.get(), dstRect, srcRect, op, blendMode);
}
- didDraw(dirtyRect);
-}
+ if (sourceImageStatus == ExternalSourceImageStatus && isAccelerated() && canvas()->buffer())
+ canvas()->buffer()->flush();
-void CanvasRenderingContext2D::drawVideo(HTMLVideoElement* video, FloatRect srcRect, FloatRect dstRect)
-{
- GraphicsContext* c = drawingContext();
- GraphicsContextStateSaver stateSaver(*c);
- c->clip(dstRect);
- c->translate(dstRect.x(), dstRect.y());
- c->scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height());
- c->translate(-srcRect.x(), -srcRect.y());
- video->paintCurrentFrameInContext(c, IntRect(IntPoint(), IntSize(video->videoWidth(), video->videoHeight())));
- stateSaver.restore();
- validateStateStack();
+ didDraw(dirtyRect);
}
void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image,
« no previous file with comments | « sky/engine/core/html/canvas/CanvasRenderingContext2D.h ('k') | sky/engine/core/html/canvas/CanvasRenderingContext2D.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698