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

Side by Side Diff: Source/platform/graphics/DiscardablePixelRef.cpp

Issue 302923003: stop calling deprecated asImageInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 41
42 bool DiscardablePixelRefAllocator::allocPixelRef(SkBitmap* dst, SkColorTable* ct able) 42 bool DiscardablePixelRefAllocator::allocPixelRef(SkBitmap* dst, SkColorTable* ct able)
43 { 43 {
44 // It should not be possible to have a non-null color table in Blink. 44 // It should not be possible to have a non-null color table in Blink.
45 ASSERT(!ctable); 45 ASSERT(!ctable);
46 46
47 int64_t size = dst->computeSize64(); 47 int64_t size = dst->computeSize64();
48 if (size < 0 || !sk_64_isS32(size)) 48 if (size < 0 || !sk_64_isS32(size))
49 return false; 49 return false;
50 50
51 SkImageInfo info; 51 const SkImageInfo& info = dst->info();
52 if (!dst->asImageInfo(&info)) 52 if (kUnknown_SkColorType == info.colorType())
pdr. 2014/05/29 04:52:14 Are these colorType checks just checking if the Sk
reed1 2014/05/29 12:10:57 Not really a question of valid. kUnknown is valid
53 return false; 53 return false;
54 54
55 SkAutoTUnref<DiscardablePixelRef> pixelRef(new DiscardablePixelRef(info, dst ->rowBytes(), adoptPtr(new SkMutex()))); 55 SkAutoTUnref<DiscardablePixelRef> pixelRef(new DiscardablePixelRef(info, dst ->rowBytes(), adoptPtr(new SkMutex())));
56 if (pixelRef->allocAndLockDiscardableMemory(sk_64_asS32(size))) { 56 if (pixelRef->allocAndLockDiscardableMemory(sk_64_asS32(size))) {
57 pixelRef->setURI(labelDiscardable); 57 pixelRef->setURI(labelDiscardable);
58 dst->setPixelRef(pixelRef.get()); 58 dst->setPixelRef(pixelRef.get());
59 // This method is only called when a DiscardablePixelRef is created to b ack a SkBitmap. 59 // This method is only called when a DiscardablePixelRef is created to b ack a SkBitmap.
60 // It is necessary to lock this SkBitmap to have a valid pointer to pixe ls. Otherwise, 60 // It is necessary to lock this SkBitmap to have a valid pointer to pixe ls. Otherwise,
61 // this SkBitmap could be assigned to another SkBitmap and locking/unloc king the other 61 // this SkBitmap could be assigned to another SkBitmap and locking/unloc king the other
62 // SkBitmap will make this one losing its pixels. 62 // SkBitmap will make this one losing its pixels.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 m_discardable->unlock(); 110 m_discardable->unlock();
111 m_lockedMemory = 0; 111 m_lockedMemory = 0;
112 } 112 }
113 113
114 bool DiscardablePixelRef::isDiscardable(SkPixelRef* pixelRef) 114 bool DiscardablePixelRef::isDiscardable(SkPixelRef* pixelRef)
115 { 115 {
116 return pixelRef && pixelRef->getURI() && !strcmp(pixelRef->getURI(), labelDi scardable); 116 return pixelRef && pixelRef->getURI() && !strcmp(pixelRef->getURI(), labelDi scardable);
117 } 117 }
118 118
119 } // namespace WebCore 119 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698