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

Side by Side Diff: skia/public/interfaces/bitmap_skbitmap_struct_traits.cc

Issue 2177073002: remove unneeded call to deprecated method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" 5 #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h"
6 6
7 namespace mojo { 7 namespace mojo {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return false; 164 return false;
165 } 165 }
166 166
167 // If the image is empty, return success after setting the image info. 167 // If the image is empty, return success after setting the image info.
168 if (data.width() == 0 || data.height() == 0) 168 if (data.width() == 0 || data.height() == 0)
169 return true; 169 return true;
170 170
171 SkAutoPixmapUnlock pixmap; 171 SkAutoPixmapUnlock pixmap;
172 if (static_cast<uint32_t>(b->width()) != data.width() || 172 if (static_cast<uint32_t>(b->width()) != data.width() ||
173 static_cast<uint32_t>(b->height()) != data.height() || 173 static_cast<uint32_t>(b->height()) != data.height() ||
174 !b->requestLock(&pixmap) || !b->lockPixelsAreWritable() || 174 !b->requestLock(&pixmap) ||
175 !b->readyToDraw()) { 175 !b->readyToDraw()) {
176 return false; 176 return false;
177 } 177 }
178 178
179 BitmapBuffer bitmap_buffer = {0, b->getSize(), 179 BitmapBuffer bitmap_buffer = {0, b->getSize(),
180 static_cast<uint8_t*>(b->getPixels())}; 180 static_cast<uint8_t*>(b->getPixels())};
181 if (!data.ReadPixelData(&bitmap_buffer) || bitmap_buffer.size != b->getSize()) 181 if (!data.ReadPixelData(&bitmap_buffer) || bitmap_buffer.size != b->getSize())
182 return false; 182 return false;
183 183
184 b->notifyPixelsChanged(); 184 b->notifyPixelsChanged();
185 return true; 185 return true;
186 } 186 }
187 187
188 // static 188 // static
189 void* StructTraits<skia::mojom::Bitmap, SkBitmap>::SetUpContext( 189 void* StructTraits<skia::mojom::Bitmap, SkBitmap>::SetUpContext(
190 const SkBitmap& b) { 190 const SkBitmap& b) {
191 b.lockPixels(); 191 b.lockPixels();
192 return nullptr; 192 return nullptr;
193 } 193 }
194 194
195 // static 195 // static
196 void StructTraits<skia::mojom::Bitmap, SkBitmap>::TearDownContext( 196 void StructTraits<skia::mojom::Bitmap, SkBitmap>::TearDownContext(
197 const SkBitmap& b, 197 const SkBitmap& b,
198 void* context) { 198 void* context) {
199 b.unlockPixels(); 199 b.unlockPixels();
200 } 200 }
201 201
202 } // namespace mojo 202 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698