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

Unified Diff: webkit/media/webmediaplayer_impl.cc

Issue 10392018: remove WEBKIT_USING_CG (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/webmediaplayer_impl.cc
diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc
index 0e6078bfb5883bdb7c3ad46585dec4a366de5317..c4edc39b2752802c8e4fca9e2f94960312c474c2 100644
--- a/webkit/media/webmediaplayer_impl.cc
+++ b/webkit/media/webmediaplayer_impl.cc
@@ -507,61 +507,7 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
DCHECK_EQ(main_loop_, MessageLoop::current());
DCHECK(proxy_);
-#if WEBKIT_USING_SKIA
proxy_->Paint(canvas, rect, alpha);
-#elif WEBKIT_USING_CG
- // Get the current scaling in X and Y.
- CGAffineTransform mat = CGContextGetCTM(canvas);
- float scale_x = sqrt(mat.a * mat.a + mat.b * mat.b);
- float scale_y = sqrt(mat.c * mat.c + mat.d * mat.d);
- float inverse_scale_x = SkScalarNearlyZero(scale_x) ? 0.0f : 1.0f / scale_x;
- float inverse_scale_y = SkScalarNearlyZero(scale_y) ? 0.0f : 1.0f / scale_y;
- int scaled_width = static_cast<int>(rect.width * fabs(scale_x));
- int scaled_height = static_cast<int>(rect.height * fabs(scale_y));
-
- // Make sure we don't create a huge canvas.
- // TODO(hclam): Respect the aspect ratio.
- if (scaled_width > static_cast<int>(media::limits::kMaxCanvas))
- scaled_width = media::limits::kMaxCanvas;
- if (scaled_height > static_cast<int>(media::limits::kMaxCanvas))
- scaled_height = media::limits::kMaxCanvas;
-
- // If there is no preexisting platform canvas, or if the size has
- // changed, recreate the canvas. This is to avoid recreating the bitmap
- // buffer over and over for each frame of video.
- if (!skia_canvas_.get() ||
- skia_canvas_->getDevice()->width() != scaled_width ||
- skia_canvas_->getDevice()->height() != scaled_height) {
- skia_canvas_.reset(
- new skia::PlatformCanvas(scaled_width, scaled_height, true));
- }
-
- // Draw to our temporary skia canvas.
- gfx::Rect normalized_rect(scaled_width, scaled_height);
- proxy_->Paint(skia_canvas_.get(), normalized_rect);
-
- // The mac coordinate system is flipped vertical from the normal skia
- // coordinates. During painting of the frame, flip the coordinates
- // system and, for simplicity, also translate the clip rectangle to
- // start at 0,0.
- CGContextSaveGState(canvas);
- CGContextTranslateCTM(canvas, rect.x, rect.height + rect.y);
- CGContextScaleCTM(canvas, inverse_scale_x, -inverse_scale_y);
-
- // We need a local variable CGRect version for DrawToContext.
- CGRect normalized_cgrect =
- CGRectMake(normalized_rect.x(), normalized_rect.y(),
- normalized_rect.width(), normalized_rect.height());
-
- // Copy the frame rendered to our temporary skia canvas onto the passed in
- // canvas.
- skia::DrawToNativeContext(skia_canvas_.get(), canvas, 0, 0,
- &normalized_cgrect);
-
- CGContextRestoreGState(canvas);
-#else
- NOTIMPLEMENTED() << "We only support rendering to skia or CG";
-#endif
}
bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698