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

Unified Diff: src/gpu/GrShape.cpp

Issue 2359933002: Use sk_careful_memcpy when writing optional conic weights for GrShape path data key. (Closed)
Patch Set: actually remove dependency Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrShape.cpp
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index b3c1e0a4cc7315f09f6588849f4c3c48d71edbc9..12fdd3bc1464d6a5bffc76c4656afdfa35b35938 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -89,7 +89,7 @@ static int path_key_from_data_size(const SkPath& path) {
}
// Writes the path data key into the passed pointer.
-static void write_path_key_from(const SkPath& path, uint32_t* origKey) {
+static void write_path_key_from_data(const SkPath& path, uint32_t* origKey) {
uint32_t* key = origKey;
// The check below should take care of negative values casted positive.
const int verbCnt = path.countVerbs();
@@ -109,7 +109,7 @@ static void write_path_key_from(const SkPath& path, uint32_t* origKey) {
memcpy(key, SkPathPriv::PointData(path), sizeof(SkPoint) * pointCnt);
GR_STATIC_ASSERT(sizeof(SkPoint) == 2 * sizeof(uint32_t));
key += 2 * pointCnt;
- memcpy(key, SkPathPriv::ConicWeightData(path), sizeof(SkScalar) * conicWeightCnt);
+ sk_careful_memcpy(key, SkPathPriv::ConicWeightData(path), sizeof(SkScalar) * conicWeightCnt);
GR_STATIC_ASSERT(sizeof(SkScalar) == sizeof(uint32_t));
SkDEBUGCODE(key += conicWeightCnt);
SkASSERT(key - origKey == path_key_from_data_size(path));
@@ -174,7 +174,7 @@ void GrShape::writeUnstyledKey(uint32_t* key) const {
case Type::kPath: {
int dataKeySize = path_key_from_data_size(fPathData.fPath);
if (dataKeySize >= 0) {
- write_path_key_from(fPathData.fPath, key);
+ write_path_key_from_data(fPathData.fPath, key);
return;
}
SkASSERT(fPathData.fGenID);
« 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