mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Merge pull request #5214 from CodingFabian/optimize-annotation-layer
Improves rendering performance of annotation layers.
This commit is contained in:
commit
6e994b15e2
2 changed files with 47 additions and 31 deletions
|
@ -79,12 +79,26 @@ var Annotation = (function AnnotationClosure() {
|
|||
data.annotationFlags = dict.get('F');
|
||||
|
||||
var color = dict.get('C');
|
||||
if (isArray(color) && color.length === 3) {
|
||||
// TODO(mack): currently only supporting rgb; need support different
|
||||
// colorspaces
|
||||
data.color = color;
|
||||
} else {
|
||||
if (!color) {
|
||||
// The PDF spec does not mention how a missing color array is interpreted.
|
||||
// Adobe Reader seems to default to black in this case.
|
||||
data.color = [0, 0, 0];
|
||||
} else if (isArray(color)) {
|
||||
switch (color.length) {
|
||||
case 0:
|
||||
// Empty array denotes transparent border.
|
||||
data.color = null;
|
||||
break;
|
||||
case 1:
|
||||
// TODO: implement DeviceGray
|
||||
break;
|
||||
case 3:
|
||||
data.color = color;
|
||||
break;
|
||||
case 4:
|
||||
// TODO: implement DeviceCMYK
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Some types of annotations have border style dict which has more
|
||||
|
@ -101,7 +115,7 @@ var Annotation = (function AnnotationClosure() {
|
|||
if (data.borderWidth > 0 && dashArray) {
|
||||
if (!isArray(dashArray)) {
|
||||
// Ignore the border if dashArray is not actually an array,
|
||||
// this is consistent with the behaviour in Adobe Reader.
|
||||
// this is consistent with the behaviour in Adobe Reader.
|
||||
data.borderWidth = 0;
|
||||
} else {
|
||||
var dashArrayLength = dashArray.length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue