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

Side by Side Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 6046009: Move base/mac_util.h to base/mac and use the base::mac namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/support/platform_support_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "gfx/blit.h" 12 #include "gfx/blit.h"
13 #include "gfx/point.h" 13 #include "gfx/point.h"
14 #include "gfx/rect.h" 14 #include "gfx/rect.h"
15 #include "skia/ext/platform_canvas.h" 15 #include "skia/ext/platform_canvas.h"
16 #include "ppapi/c/pp_errors.h" 16 #include "ppapi/c/pp_errors.h"
17 #include "ppapi/c/pp_module.h" 17 #include "ppapi/c/pp_module.h"
18 #include "ppapi/c/pp_rect.h" 18 #include "ppapi/c/pp_rect.h"
19 #include "ppapi/c/pp_resource.h" 19 #include "ppapi/c/pp_resource.h"
20 #include "ppapi/c/ppb_graphics_2d.h" 20 #include "ppapi/c/ppb_graphics_2d.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "webkit/plugins/ppapi/common.h" 22 #include "webkit/plugins/ppapi/common.h"
23 #include "webkit/plugins/ppapi/plugin_module.h" 23 #include "webkit/plugins/ppapi/plugin_module.h"
24 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 24 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
25 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" 25 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
26 26
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 #include "base/mac_util.h" 28 #include "base/mac/mac_util.h"
29 #include "base/mac/scoped_cftyperef.h" 29 #include "base/mac/scoped_cftyperef.h"
30 #endif 30 #endif
31 31
32 namespace webkit { 32 namespace webkit {
33 namespace ppapi { 33 namespace ppapi {
34 34
35 namespace { 35 namespace {
36 36
37 // Converts a rect inside an image of the given dimensions. The rect may be 37 // Converts a rect inside an image of the given dimensions. The rect may be
38 // NULL to indicate it should be the entire image. If the rect is outside of 38 // NULL to indicate it should be the entire image. If the rect is outside of
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 return false; 242 return false;
243 } 243 }
244 is_always_opaque_ = is_always_opaque; 244 is_always_opaque_ = is_always_opaque;
245 return true; 245 return true;
246 } 246 }
247 247
248 PPB_Graphics2D_Impl* PPB_Graphics2D_Impl::AsPPB_Graphics2D_Impl() { 248 PPB_Graphics2D_Impl* PPB_Graphics2D_Impl::AsPPB_Graphics2D_Impl() {
249 return this; 249 return this;
250 } 250 }
251 251
252 PP_Bool PPB_Graphics2D_Impl::Describe(PP_Size* size, PP_Bool* is_always_opaque) { 252 PP_Bool PPB_Graphics2D_Impl::Describe(PP_Size* size,
253 PP_Bool* is_always_opaque) {
253 size->width = image_data_->width(); 254 size->width = image_data_->width();
254 size->height = image_data_->height(); 255 size->height = image_data_->height();
255 *is_always_opaque = PP_FALSE; // TODO(brettw) implement this. 256 *is_always_opaque = PP_FALSE; // TODO(brettw) implement this.
256 return PP_TRUE; 257 return PP_TRUE;
257 } 258 }
258 259
259 void PPB_Graphics2D_Impl::PaintImageData(PP_Resource image_data, 260 void PPB_Graphics2D_Impl::PaintImageData(PP_Resource image_data,
260 const PP_Point* top_left, 261 const PP_Point* top_left,
261 const PP_Rect* src_rect) { 262 const PP_Rect* src_rect) {
262 if (!top_left) 263 if (!top_left)
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 SkAutoLockPixels lock(backing_bitmap); 491 SkAutoLockPixels lock(backing_bitmap);
491 492
492 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( 493 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
493 CGDataProviderCreateWithData( 494 CGDataProviderCreateWithData(
494 NULL, backing_bitmap.getAddr32(0, 0), 495 NULL, backing_bitmap.getAddr32(0, 0),
495 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL)); 496 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL));
496 base::mac::ScopedCFTypeRef<CGImageRef> image( 497 base::mac::ScopedCFTypeRef<CGImageRef> image(
497 CGImageCreate( 498 CGImageCreate(
498 backing_bitmap.width(), backing_bitmap.height(), 499 backing_bitmap.width(), backing_bitmap.height(),
499 8, 32, backing_bitmap.rowBytes(), 500 8, 32, backing_bitmap.rowBytes(),
500 mac_util::GetSystemColorSpace(), 501 base::mac::GetSystemColorSpace(),
501 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, 502 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
502 data_provider, NULL, false, kCGRenderingIntentDefault)); 503 data_provider, NULL, false, kCGRenderingIntentDefault));
503 504
504 // Flip the transform 505 // Flip the transform
505 CGContextSaveGState(canvas); 506 CGContextSaveGState(canvas);
506 float window_height = static_cast<float>(CGBitmapContextGetHeight(canvas)); 507 float window_height = static_cast<float>(CGBitmapContextGetHeight(canvas));
507 CGContextTranslateCTM(canvas, 0, window_height); 508 CGContextTranslateCTM(canvas, 0, window_height);
508 CGContextScaleCTM(canvas, 1.0, -1.0); 509 CGContextScaleCTM(canvas, 1.0, -1.0);
509 510
510 CGRect bounds; 511 CGRect bounds;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 644
644 bool PPB_Graphics2D_Impl::HasPendingFlush() const { 645 bool PPB_Graphics2D_Impl::HasPendingFlush() const {
645 return !unpainted_flush_callback_.is_null() || 646 return !unpainted_flush_callback_.is_null() ||
646 !painted_flush_callback_.is_null() || 647 !painted_flush_callback_.is_null() ||
647 offscreen_flush_pending_; 648 offscreen_flush_pending_;
648 } 649 }
649 650
650 } // namespace ppapi 651 } // namespace ppapi
651 } // namespace webkit 652 } // namespace webkit
652 653
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/support/platform_support_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698