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

Side by Side Diff: ui/gfx/surface/transport_dib_mac.cc

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address style issues. Created 8 years, 10 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/surface/transport_dib.h" 5 #include "ui/gfx/surface/transport_dib.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include "base/eintr_wrapper.h" 10 #include "base/eintr_wrapper.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // static 58 // static
59 bool TransportDIB::is_valid_id(Id id) { 59 bool TransportDIB::is_valid_id(Id id) {
60 return id != 0; 60 return id != 0;
61 } 61 }
62 62
63 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { 63 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
64 if (!memory() && !Map()) 64 if (!memory() && !Map())
65 return NULL; 65 return NULL;
66 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); 66 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
67 if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory()))) 67 if (!canvas->initialize(
68 w, h,
69 skia::PlatformDevice::FLAGS_OPAQUE |
70 skia::PlatformDevice::FLAGS_INITIALIZED,
71 reinterpret_cast<uint8_t*>(memory())))
68 return NULL; 72 return NULL;
69 return canvas.release(); 73 return canvas.release();
70 } 74 }
71 75
72 bool TransportDIB::Map() { 76 bool TransportDIB::Map() {
73 if (!is_valid_handle(handle())) 77 if (!is_valid_handle(handle()))
74 return false; 78 return false;
75 if (memory()) 79 if (memory())
76 return true; 80 return true;
77 81
(...skipping 11 matching lines...) Expand all
89 return shared_memory_.memory(); 93 return shared_memory_.memory();
90 } 94 }
91 95
92 TransportDIB::Id TransportDIB::id() const { 96 TransportDIB::Id TransportDIB::id() const {
93 return shared_memory_.id(); 97 return shared_memory_.id();
94 } 98 }
95 99
96 TransportDIB::Handle TransportDIB::handle() const { 100 TransportDIB::Handle TransportDIB::handle() const {
97 return shared_memory_.handle(); 101 return shared_memory_.handle();
98 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698