| OLD | NEW |
| 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/glue/plugins/pepper_graphics_2d.h" | 5 #include "webkit/glue/plugins/pepper_graphics_2d.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" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 image_data_ = new ImageData(module()); | 236 image_data_ = new ImageData(module()); |
| 237 if (!image_data_->Init(ImageData::GetNativeImageDataFormat(), width, height, | 237 if (!image_data_->Init(ImageData::GetNativeImageDataFormat(), width, height, |
| 238 true) || !image_data_->Map()) { | 238 true) || !image_data_->Map()) { |
| 239 image_data_ = NULL; | 239 image_data_ = NULL; |
| 240 return false; | 240 return false; |
| 241 } | 241 } |
| 242 is_always_opaque_ = is_always_opaque; | 242 is_always_opaque_ = is_always_opaque; |
| 243 return true; | 243 return true; |
| 244 } | 244 } |
| 245 | 245 |
| 246 Graphics2D* Graphics2D::AsGraphics2D() { |
| 247 return this; |
| 248 } |
| 249 |
| 246 PP_Bool Graphics2D::Describe(PP_Size* size, PP_Bool* is_always_opaque) { | 250 PP_Bool Graphics2D::Describe(PP_Size* size, PP_Bool* is_always_opaque) { |
| 247 size->width = image_data_->width(); | 251 size->width = image_data_->width(); |
| 248 size->height = image_data_->height(); | 252 size->height = image_data_->height(); |
| 249 *is_always_opaque = PP_FALSE; // TODO(brettw) implement this. | 253 *is_always_opaque = PP_FALSE; // TODO(brettw) implement this. |
| 250 return PP_TRUE; | 254 return PP_TRUE; |
| 251 } | 255 } |
| 252 | 256 |
| 253 void Graphics2D::PaintImageData(PP_Resource image_data, | 257 void Graphics2D::PaintImageData(PP_Resource image_data, |
| 254 const PP_Point* top_left, | 258 const PP_Point* top_left, |
| 255 const PP_Rect* src_rect) { | 259 const PP_Rect* src_rect) { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 data.Execute(PP_OK); | 633 data.Execute(PP_OK); |
| 630 } | 634 } |
| 631 | 635 |
| 632 bool Graphics2D::HasPendingFlush() const { | 636 bool Graphics2D::HasPendingFlush() const { |
| 633 return !unpainted_flush_callback_.is_null() || | 637 return !unpainted_flush_callback_.is_null() || |
| 634 !painted_flush_callback_.is_null() || | 638 !painted_flush_callback_.is_null() || |
| 635 offscreen_flush_pending_; | 639 offscreen_flush_pending_; |
| 636 } | 640 } |
| 637 | 641 |
| 638 } // namespace pepper | 642 } // namespace pepper |
| OLD | NEW |