OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkAndroidSDKCanvas.h" | 8 #include "SkAndroidSDKCanvas.h" |
9 | 9 |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 | 267 |
268 bool SkAndroidSDKCanvas::isClipEmpty() const { return fProxyTarget->isClipEmpty(
); } | 268 bool SkAndroidSDKCanvas::isClipEmpty() const { return fProxyTarget->isClipEmpty(
); } |
269 bool SkAndroidSDKCanvas::isClipRect() const { return fProxyTarget->isClipRect();
} | 269 bool SkAndroidSDKCanvas::isClipRect() const { return fProxyTarget->isClipRect();
} |
270 | 270 |
271 SkSurface* SkAndroidSDKCanvas::onNewSurface(const SkImageInfo& info, | 271 SkSurface* SkAndroidSDKCanvas::onNewSurface(const SkImageInfo& info, |
272 const SkSurfaceProps& props
) { | 272 const SkSurfaceProps& props
) { |
273 return fProxyTarget->newSurface(info, &props); | 273 return fProxyTarget->newSurface(info, &props); |
274 } | 274 } |
275 | 275 |
276 const void* SkAndroidSDKCanvas::onPeekPixels(SkImageInfo* info, size_t* data) { | 276 bool SkAndroidSDKCanvas::onPeekPixels(SkPixmap* pmap) { |
277 return fProxyTarget->peekPixels(info, data); | 277 SkASSERT(pmap); |
| 278 SkImageInfo info; |
| 279 size_t rowBytes; |
| 280 const void* addr = fProxyTarget->peekPixels(&info, &rowBytes); |
| 281 if (addr) { |
| 282 pmap->reset(info, addr, rowBytes); |
| 283 return true; |
| 284 } |
| 285 return false; |
278 } | 286 } |
279 | 287 |
280 void* SkAndroidSDKCanvas::onAccessTopLayerPixels(SkImageInfo* info, size_t* data
) { | 288 bool SkAndroidSDKCanvas::onAccessTopLayerPixels(SkPixmap* pmap) { |
281 return fProxyTarget->accessTopLayerPixels(info, data); | 289 SkASSERT(pmap); |
| 290 SkImageInfo info; |
| 291 size_t rowBytes; |
| 292 const void* addr = fProxyTarget->accessTopLayerPixels(&info, &rowBytes, NULL
); |
| 293 if (addr) { |
| 294 pmap->reset(info, addr, rowBytes); |
| 295 return true; |
| 296 } |
| 297 return false; |
282 } | 298 } |
283 | 299 |
284 void SkAndroidSDKCanvas::willSave() { | 300 void SkAndroidSDKCanvas::willSave() { |
285 fProxyTarget->save(); | 301 fProxyTarget->save(); |
286 } | 302 } |
287 | 303 |
288 SkCanvas::SaveLayerStrategy SkAndroidSDKCanvas::willSaveLayer(const SkRect* rect
, | 304 SkCanvas::SaveLayerStrategy SkAndroidSDKCanvas::willSaveLayer(const SkRect* rect
, |
289 const SkPaint* pai
nt, | 305 const SkPaint* pai
nt, |
290 SaveFlags flags) { | 306 SaveFlags flags) { |
291 fProxyTarget->saveLayer(rect, paint, flags); | 307 fProxyTarget->saveLayer(rect, paint, flags); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 fProxyTarget->clipPath(path, op, style); | 340 fProxyTarget->clipPath(path, op, style); |
325 } | 341 } |
326 | 342 |
327 void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { | 343 void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { |
328 fProxyTarget->clipRegion(region, op); | 344 fProxyTarget->clipRegion(region, op); |
329 } | 345 } |
330 | 346 |
331 void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); } | 347 void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); } |
332 | 348 |
333 | 349 |
OLD | NEW |