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

Side by Side Diff: ppapi/proxy/ppb_image_data_proxy.cc

Issue 2519083002: Revert "Revert "Change call-sites now that SkCanvas is not ref-counted"" (Closed)
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.h ('k') | skia/config/SkUserConfig.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ppapi/proxy/ppb_image_data_proxy.h" 5 #include "ppapi/proxy/ppb_image_data_proxy.h"
6 6
7 #include <string.h> // For memcpy 7 #include <string.h> // For memcpy
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 PlatformImageData::~PlatformImageData() { 382 PlatformImageData::~PlatformImageData() {
383 } 383 }
384 384
385 void* PlatformImageData::Map() { 385 void* PlatformImageData::Map() {
386 if (!mapped_canvas_.get()) { 386 if (!mapped_canvas_.get()) {
387 if (!transport_dib_.get()) 387 if (!transport_dib_.get())
388 return NULL; 388 return NULL;
389 389
390 const bool is_opaque = false; 390 const bool is_opaque = false;
391 mapped_canvas_ = 391 mapped_canvas_ = transport_dib_->GetPlatformCanvas(
392 sk_sp<SkCanvas>(transport_dib_->GetPlatformCanvas(desc_.size.width, 392 desc_.size.width, desc_.size.height, is_opaque);
393 desc_.size.height,
394 is_opaque));
395 if (!mapped_canvas_.get()) 393 if (!mapped_canvas_.get())
396 return NULL; 394 return NULL;
397 } 395 }
398 SkPixmap pixmap; 396 SkPixmap pixmap;
399 skia::GetWritablePixels(mapped_canvas_.get(), &pixmap); 397 skia::GetWritablePixels(mapped_canvas_.get(), &pixmap);
400 return pixmap.writable_addr(); 398 return pixmap.writable_addr();
401 } 399 }
402 400
403 void PlatformImageData::Unmap() { 401 void PlatformImageData::Unmap() {
404 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't 402 // TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // still cached in our process, the proxy still holds a reference so we can 668 // still cached in our process, the proxy still holds a reference so we can
671 // remove the one the renderer just sent is. If the proxy no longer holds a 669 // remove the one the renderer just sent is. If the proxy no longer holds a
672 // reference, we released everything and we should also release the one the 670 // reference, we released everything and we should also release the one the
673 // renderer just sent us. 671 // renderer just sent us.
674 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 672 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
675 API_ID_PPB_CORE, old_image_data)); 673 API_ID_PPB_CORE, old_image_data));
676 } 674 }
677 675
678 } // namespace proxy 676 } // namespace proxy
679 } // namespace ppapi 677 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.h ('k') | skia/config/SkUserConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698