mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Bug 1454692 - Backport some upstream Skia fixes to ESR52. r=rhunt, a=abillings
--HG-- extra : histedit_source : 0fcd64cabe6f54a2286083d6518e4e6451183a19%2C37f5e7f9dbbfc01102631c33b23329d2af5aa71b
This commit is contained in:
parent
8e5fec311a
commit
31eaa575a5
3 changed files with 17 additions and 4 deletions
|
|
@ -43,7 +43,12 @@ uint8_t* SkMask::AllocImage(size_t size) {
|
|||
#ifdef TRACK_SKMASK_LIFETIME
|
||||
SkDebugf("SkMask::AllocImage %d\n", gCounter++);
|
||||
#endif
|
||||
return (uint8_t*)sk_malloc_throw(SkAlign4(size));
|
||||
size_t aligned_size = std::numeric_limits<size_t>::max();
|
||||
size_t adjustment = 3;
|
||||
if (size + adjustment > size) {
|
||||
aligned_size = (size + adjustment) & ~adjustment;
|
||||
}
|
||||
return static_cast<uint8_t*>(sk_malloc_throw(aligned_size));
|
||||
}
|
||||
|
||||
/** We explicitly use this allocator for SkBimap pixels, so that we can
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "GrResourceProvider.h"
|
||||
#include "GrTypes.h"
|
||||
|
||||
#include "SkSafeMath.h"
|
||||
#include "SkTraceEvent.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
|
|
@ -335,7 +336,7 @@ void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize,
|
|||
SkASSERT(startVertex);
|
||||
|
||||
size_t offset = 0; // assign to suppress warning
|
||||
void* ptr = INHERITED::makeSpace(vertexSize * vertexCount,
|
||||
void* ptr = INHERITED::makeSpace(SkSafeMath::Mul(vertexSize, vertexCount),
|
||||
vertexSize,
|
||||
buffer,
|
||||
&offset);
|
||||
|
|
@ -360,7 +361,7 @@ void* GrIndexBufferAllocPool::makeSpace(int indexCount,
|
|||
SkASSERT(startIndex);
|
||||
|
||||
size_t offset = 0; // assign to suppress warning
|
||||
void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t),
|
||||
void* ptr = INHERITED::makeSpace(SkSafeMath::Mul(indexCount, sizeof(uint16_t)),
|
||||
sizeof(uint16_t),
|
||||
buffer,
|
||||
&offset);
|
||||
|
|
|
|||
|
|
@ -828,6 +828,13 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
|
|||
|
||||
int lineCount = lines.count() / 2;
|
||||
int conicCount = conics.count() / 3;
|
||||
int quadAndConicCount = conicCount + quadCount;
|
||||
|
||||
static constexpr int kMaxLines = SK_MaxS32 / kLineSegNumVertices;
|
||||
static constexpr int kMaxQuadsAndConics = SK_MaxS32 / kQuadNumVertices;
|
||||
if (lineCount > kMaxLines || quadAndConicCount > kMaxQuadsAndConics) {
|
||||
return;
|
||||
}
|
||||
|
||||
// do lines first
|
||||
if (lineCount) {
|
||||
|
|
@ -899,7 +906,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
|
|||
ref_quads_index_buffer(target->resourceProvider()));
|
||||
|
||||
size_t vertexStride = sizeof(BezierVertex);
|
||||
int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * conicCount;
|
||||
int vertexCount = kQuadNumVertices * quadAndConicCount;
|
||||
void *vertices = target->makeVertexSpace(vertexStride, vertexCount,
|
||||
&vertexBuffer, &firstVertex);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue